Exemplo n.º 1
0
        public static IEnumerable <BaseSelect> GetAllSelect(Type selectType)
        {
            var dbset = BaseCruds.GetRepo().GetDbSet(selectType);

            if (dbset == null)
            {
                return(Enumerable.Empty <BaseSelect>());
            }
            try
            {
                return(Queryable.Where <BaseSelect>(dbset as IQueryable <BaseSelect>, b => true).ToList());
            }
            catch {
                return(Enumerable.Empty <BaseSelect>());
            }
        }
Exemplo n.º 2
0
        public static void Create(object input)
        {
            var type      = input.GetType().GetRealType();
            var repo      = BaseCruds.GetRepo();
            var addMethod = repo.GetMethod(type, "Add", out object p);

            if (addMethod != null)
            {
                try
                {
                    addMethod.Invoke(p, new object[1] {
                        input
                    });
                    repo.SaveChanges();
                }
                catch
                {
                }
            }
        }
Exemplo n.º 3
0
 public static IQueryable <T> Read <T>(Expression <Func <T, bool> > where, out ISave repo) where T : class
 {
     repo = BaseCruds.GetRepo();
     return(Read <T>(where, repo));
 }