执行代码:[code=C#][/code] private static void TestOrder() { using (var edm = new TestDBEntities()) { Product p = new Product(); p.pId = 5; p.pName = "商品";
Order order = new Order(); order.OrderName = "hunaifei"; order.Product.Add(p); order.Product.Add(p); //order.Product = null; edm.AddToOrder(order); int result = edm.SaveChanges();