Example #1
0
        public object Clone()
        {
            var newObject = new ModelCollection <T>();

            foreach (var item in Items)
            {
                newObject.Add(item);
            }
            return(newObject);
        }
Example #2
0
        public static ModelCollection <T> ToModelCollection <T>(this IEnumerable <T> list) where T : IModel
        {
            ModelCollection <T> coll = new ModelCollection <T>();

            foreach (var item in list)
            {
                coll.Add(item);
            }
            return(coll);
        }
Example #3
0
        private ModelCollection <T> QueryCollection <T>(ExecuteUnit unit) where T : new()
        {
            DataTable           dt   = this.DataHelper.ExecuteDataTable(unit.CommandText, unit.Session, unit.DbParams.ToArray());
            ModelCollection <T> coll = new ModelCollection <T>();
            Type elementType         = coll.ElementType;

            foreach (DataRow row in dt.Rows)
            {
                T model = DataRowToT <T>(row);
                coll.Add(model);
            }

            return(coll);
        }