示例#1
0
 public void Add <T>(T obj) where T : class
 {
     using (var ctx = new TrackerEntities())
     {
         ctx.Set <T>().Add(obj);
     }
 }
示例#2
0
        public List <T> GetProducts <T>() where T : class
        {
            var Products = new List <T>();

            using (var ctx = new TrackerEntities())
            {
                Products = ctx.Set <T>().ToList();
            }

            return(Products);
        }