예제 #1
0
        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);
        }
예제 #2
0
        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;
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
 public static E PopulateFromDataRow(E entity, DataRow row)
 {
     return((E)EntityReader.PopulateFromDataRow(entity, row));
 }