public virtual List <object> DataTableToList(DataTable table) { List <object> result = new List <object>(); foreach (DataRow row in table.Rows) { object e = EntityReader.PopulateFromDataRow(Activator.CreateInstance(_entityType), row); result.Add(e); } return(result); }
public virtual void OverrideFromDataTable(DataTable table) { List <object> result = new List <object>(); foreach (DataRow row in table.Rows) { object e = EntityReader.PopulateFromDataRow(Activator.CreateInstance(_entityType), row); result.Add(e); } Clear(); _entities = null; _entities = result; }
public static List <object> GetEntitiesFromDataTable(DataTable table, Type entityType) { List <object> result = new List <object>(); if (table != null) { foreach (DataRow row in table.Rows) { object e = Activator.CreateInstance(entityType); EntityReader.PopulateFromDataRow(e, row); result.Add(e); } } return(result); }
public virtual Dictionary <Guid, object> DataTableToDictionary(DataTable table) { Dictionary <Guid, object> result = new Dictionary <Guid, object>(); foreach (DataRow row in table.Rows) { object e = EntityReader.PopulateFromDataRow(Activator.CreateInstance(_entityType), row); Guid entityId; while (true) { entityId = Guid.NewGuid(); if (result.ContainsKey(entityId)) { continue; } break; } result.Add(entityId, e); } return(result); }
public static E PopulateFromDataRow(E entity, DataRow row) { return((E)EntityReader.PopulateFromDataRow(entity, row)); }