Пример #1
0
        public void Respository()
        {
            UnitOfWork work = new UnitOfWork();

            work.LibraryRepository.Add(new uLibrary()
            {
                Doubt            = "Test01",
                DoubtDesc        = "Test01 Desc",
                ProcessDoubtWay  = "Test01 Way",
                Contributor      = "Edwin",
                ContributeDate   = DateTime.Now,
                LastUpdateDate   = DateTime.Now,
                DifficultyTypeId = 1,
                Fun       = "3PF->Add",
                FunTypeId = 1,
                LCV       = false
            });

            work.SaveChanges();
            //using (MyProject.DAL.EF.MyProjectEF db = new DAL.EF.MyProjectEF())
            //{
            //    var ccc = db.uCodes.Where(p => p.CodeId == 1);
            //    foreach (var c in ccc)
            //    {

            //    }
            //}
            MyProjectEF         db  = new MyProjectEF();
            IRepository <uCode> rep = new Repository <uCode>(db);
            var list = rep.Query(p => p.CodeId == 1);

            foreach (var l in list)
            {
            }
        }
Пример #2
0
        public void AddNewTest()
        {
            using (System.Data.Entity.Core.EntityClient.EntityConnection entity = new System.Data.Entity.Core.EntityClient.EntityConnection("MyProjectEF1"))
            {
                entity.Open();
                EntityCommand cmd = entity.CreateCommand();
                cmd.CommandText = @"select doubt d from uLibrary as d where d.";
            }



            MyProjectEF mp = new MyProjectEF();



            mp.uLibrary.ToList();

            mp.uUsers.Add(new uUser()
            {
                UserName     = "******",
                Password     = Base64Helper.Base64Encode("msc@123321"),
                Email        = "*****@*****.**",
                CreationDate = DateTime.Now,
                EditDate     = DateTime.Now,
                FirstName    = "Edwin",
                LastName     = "Nie",
                FullName     = "Edwin Nie",
                LCV          = false
            });
            mp.SaveChanges();
        }
Пример #3
0
        public void UpdateTest()
        {
            MyProjectEF db = new MyProjectEF();

            FunctionRepository rep = new FunctionRepository(db);

            var aa = rep.Query(p => p.FunId == 2).FirstOrDefault();

            aa.FunDesc += "111232131";

            rep.Update(aa);
        }
Пример #4
0
        public void CreateNewFunctions()
        {
            MyProjectEF ef = new MyProjectEF();

            uFunction fun = new uFunction();

            fun.FunName      = "Dashboard";
            fun.FunTypeId    = 1;
            fun.LCV          = false;
            fun.CreationDate = DateTime.Now;
            fun.FunSeq       = 0;
            ef.uFunctions.Add(fun);
            ef.SaveChanges();
        }