Adapter , LLBL Gen 3.1
I write an sql query and get the result as the DataTable from SQL Server
I want to change dataTable to EntityCollection, just like the following code
T is the generic parameter, such as CustomerEntity,RegionEntity.
EntityCollection<T> entities = new EntityCollection<T>();
foreach (DataRow row in table.Rows)
{
T newCustomer = (T)entities.AddNew();
foreach (DataColumn column in table.Columns)
{
newCustomer.SetNewFieldValue(column.ColumnName, row[column]);
}
}
}
somtimes it works, but it has bug. such as Table Log(LogID)
it will generate mapping field Logid, LogEntity.
so, the SetNewFieldValue won't work, because can not find the LogID property(the generated property name is Logid) .
found a method here
http://stackoverflow.com/questions/6191462/llblgen-load-a-entitycollection-or-list-from-a-datatable
but I want it more common,so, I want to know, is there any a way to implementation this?
or ,can you give me the mapping rule, how to get the generated property name by its data column name? for this example, data column is LogID, the generated property name is Logid
how the designer do this, thank you