Irwsoft Data Framework

Data-schema Extension
Brief Information
Versions4.0 and above.
EditionsAll Editions
TopicsUsing data-schema extension.

Data-schema extension allows developer to use another class model than default Irwsoft Data Framework data-schema class. With the data-schema extension feature, you can design your own class model as data-schema in IDF mappers.

At the moment there are three common data-schema extension supported by Irwsoft Data Framework :

  • Entity Framework table data-schema extension
  • Linq to Sql Framework table data-schema extension
  • Simple object table data-schema extension

All extensions can be used together in one query. When using data-schema extension with method that need a column, use Irwsoft.Data.Map.Column method to specify the column of table-schema extension.

public static Column Column(Object dataSchema, String name).

Here is the example if you have generated table-classes using Entity Framework.

C# code
// Declare and initiate a new instance Person table.
Person person = new Person();

// using SqlSelectFrom to use select SQL-object
SqlSelectFrom select = new SqlSelectFrom(person);

// Don’t forget to set connection string !
select.ConnectionString = "...";

// NOTE : if you not specify the column, all columns will be included !
//        Here is how to filter columns to display selected columns with data-schema extension.
//        First argument is the data-schema instance and the second argument is column name.
select.Column(Map< .Column(Person, "PersonId"), Map.Column(Person, "FirstName"));

// Set where condition FirstName = "Andy" with data-schema extension.
// same like above for data-schema extension you must use Map.Column method.
select.Where.Compare(Map.Column(Person, "FirstName"), ComparisonOperator.Equal, "Andy");

// Execute the query and return DataView instance that provide properties and methods to access data
// Note : DataView provide paging feature.

Irwsoft.Data.DataView dv = select.Execute();

// Here how to retrieve the value of 'FirstName' in the first row.
String firstName = dv.Rows[0][Map.Column(Person, "FirstName")].ToString();

// To retrieve the value of 'FirstName' with index.
String firstName = dv.Rows[0][1].ToString();

Related Topics :

Irwsoft Data Ultimate Edition provides all enhanced features of Irwsoft Data Framework and support from irwsoft.