C# 使用wcf数据服务客户端库/odata进行深度插入

C# 使用wcf数据服务客户端库/odata进行深度插入,c#,wcf,wcf-data-services,odata,C#,Wcf,Wcf Data Services,Odata,我们正在计划做深插入下面是它的代码。没用了,谁能帮帮我 Order orderObj = new Order OrderDetail oDetailObj = new OrderDetail context.AttachTo(Orders, orderObj); Code to set properties of orderObj for loop to add orders details { Code to set properties of oDetailObj cont

我们正在计划做深插入下面是它的代码。没用了,谁能帮帮我

Order orderObj = new Order

OrderDetail oDetailObj = new OrderDetail 

context.AttachTo(Orders, orderObj);

Code to set properties of orderObj 

for loop to add orders details
{

Code to set properties of oDetailObj 

context.AddRelatedObject(orderObj, "OrderDetailsList", oDetailObj); 

} 

使用DataServiceContext进行深度插入的唯一方法是使用批处理模式。虽然OData协议支持深度插入,但DataServiceContext中没有这种支持

要进行批处理,请调用ctx.SaveChanges(SaveChangesOptions.Batch)

希望这有帮助

谢谢
Pratik

这个实体框架是->
上下文吗?
?什么不起作用?您是否有错误消息?@DonA…这是数据服务上下文(使用wcf数据服务客户端库)@Robesz…我在fiddler中看到它没有为子对象生成atompub xml(订单详细信息)。Atompub xml仅适用于父对象(订单),是否可以通过…IOdataRequestMessage?