c# - Enumerating a LINQ-to-SQL DataContext -


i looking enumerate through tables in datacontext have created using o/r designer.

based on this question, i'm presently using reflection so, i.e.

propertyinfo[] dc_properties = data.gettype().getproperties(); //data datacontext propertyinfo[] row_properties;  foreach (var prop in dc_properties) {   object value = prop.getvalue(data);    if(value itable)   {     var table = (itable)value; //value table      foreach (var item in table) //item row in table     {       row_properties = item.gettype().getproperties(); //row_properties values of row       foreach (var prop2 in row_properties)        {         object value2 = prop2.getvalue(item); //prop2 value       }     }   } } 

however, slow. know better way enumerate through datacontext , obtain values of rows of tables in it?

thank you.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -