Exemple #1
0
        static void Main(string[] args)
        {
            DemoModel  entity   = new DemoModel();
            T_Customer customer = new T_Customer {
                Address = "Wuhan Hongshan", Age = 24, UserName = "******"
            };

            entity.T_Customer.Add(customer); // 这里只相当于SQL语句
            entity.SaveChanges();            // 这里才进行数据库操作,相当于F5执行
        }
Exemple #2
0
        static void Main(string[] args)
        {
            DataModel  dataModel  = new DataModel();
            T_Customer t_Customer = new T_Customer
            {
                Address  = "东海五彩金轮",
                Age      = 27,
                UserName = "******"
            };

            dataModel.T_Customer.Add(t_Customer);
            dataModel.SaveChanges();
            Console.WriteLine("ok");

            Console.ReadKey();
        }