读书人

关于代码中的product?解决办法

发布时间: 2012-07-05 07:59:18 作者: rapoo

关于代码中的product?

C# code
// Create the DataServiceContext using the service URI.NorthwindEntities context = new NorthwindEntities(svcUri);// Create the new product.Product newProduct =    Product.CreateProduct(0, "White Tea - loose", false);// Set property values.newProduct.QuantityPerUnit = "120gm bags";newProduct.ReorderLevel = 5;newProduct.UnitPrice = 5.2M;try{    // Add the new product to the Products entity set.    context.AddToProducts(newProduct);    // Send the insert to the data service.    context.SaveChanges();    Console.WriteLine("New product added with ID {0}.", newProduct.ProductID);}catch (DataServiceRequestException ex){    throw new ApplicationException(        "An error occurred when saving changes.", ex);}

这个是wcf数据服务中添加实体的代码,vs报错,这个product是哪里来的呢?应当替换成什么呢?另外这个实体数据添加到了哪个位置呢?

[解决办法]
Product 这个应该是一个工厂类。哪里来的得自己找哇。直接转到看有没有

读书人网 >C#

热点推荐