示例#1
0
文件: Program.cs 项目: kimx/Examples
        static void Main(string[] args)
        {
            Customer customer = new Customer
            {
                Name = "Michael Tsai"
            };

            using (var context = new SalesContext())
            {
                context.Customers.Add(customer);
                context.SaveChanges();

                foreach (var cust in context.Customers)
                {
                    Console.WriteLine("{0}: {1}", cust.Id, cust.Name);
                };
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            Customer customer = new Customer
            {
                Name = "Michael Tsai"
            };

            using (var context = new SalesContext())
            {
                context.Customers.Add(customer);
                context.SaveChanges();

                foreach (var cust in context.Customers)
                {
                    Console.WriteLine("{0}: {1}", cust.Id, cust.Name);
                }
                ;
            }
        }