Beispiel #1
0
        static void Listing21_10()
        {
            Console.WriteLine("{0} : Begin", new StackTrace(0, true).GetFrame(0).GetMethod().Name);

            NorthwindEntities context = new NorthwindEntities();

            // create a new customer object
            Customer cust = context.CreateObject <Customer>();

            // populate all of the fields
            cust.CustomerID   = "LAWN";
            cust.CompanyName  = "Lawn Wranglers";
            cust.ContactName  = "Mr. Abe Henry";
            cust.ContactTitle = "Owner";
            cust.Address      = "1017 Maple Leaf Way";
            cust.City         = "Ft. Worth";
            cust.Region       = "TX";
            cust.PostalCode   = "76104";
            cust.Country      = "USA";
            cust.Phone        = "(800) MOW-LAWN";
            cust.Fax          = "(800) MOW-LAWO";

            context.AddObject("Customers", cust);

            context.SaveChanges();

            Console.WriteLine("{0} : End", new StackTrace(0, true).GetFrame(0).GetMethod().Name);
        }