Beispiel #1
0
 public DbOperation()
 {
     DbContext = new GEEDbContext();
     if (DbContext == null)
     {
         throw new ArgumentNullException("Null DbContext");
     }
 }
Beispiel #2
0
 public MyDataAccess()
 {
     DbContext = new GEEDbContext();
     if (DbContext == null)
     {
         throw new ArgumentNullException("Null DbContext");
     }
     DbSet = DbContext.Set <T>();
 }
Beispiel #3
0
        public virtual List <T> GetDDl(string tblName, string Fname, string Code, string Cond)
        {
            using (var context = new GEEDbContext())
            {
                //var TbName = new SqlParameter("@TbName", "Religion");
                //var fname = new SqlParameter("@fname", "ReligionName");
                //var code = new SqlParameter("@code", "Religion_ID");
                //var cond = new SqlParameter("@cond", "ISDeleted=0");

                var TbName = new SqlParameter("@TbName", tblName);
                var fname  = new SqlParameter("@fname", Fname);
                var code   = new SqlParameter("@code", Code);
                var cond   = new SqlParameter("@cond", Cond);


                var result = context.Database
                             .SqlQuery <T>("FillCombo @TbName, @fname, @code, @cond", TbName, fname, code, cond)
                             .ToList();

                return(result);
            }

            //using (var context = new GEEDbContext())
            //{
            //    var TbName = new SqlParameter("@TbName", tblName);
            //    var fname = new SqlParameter("@fname", Fname);
            //    var code = new SqlParameter("@code", Code);
            //    var cond = new SqlParameter("@cond", Cond);


            //    var result = context.Database
            //        .SqlQuery<T>("FillCombo @TbName, @fname, @code, @cond", TbName, fname, code, cond)
            //        .ToList();

            //    return result;
            //}
        }