【发布时间】:2017-04-04 21:11:30
【问题描述】:
我有来自 codeplex 的这段代码
private async Task ExecuteChangeSet(
ChangeSetRequestItem changeSet,
IList<ODataBatchResponseItem> responses,
CancellationToken cancellation)
{
ChangeSetResponseItem changeSetResponse;
// Create a new ShoppingContext instance, associate it with each of the requests, start a new
// transaction, execute the changeset and then commit or rollback the transaction depending on
// whether the responses were all successful or not.
using (ShoppingContext context = new ShoppingContext())
{
foreach (HttpRequestMessage request in changeSet.Requests)
{
request.SetContext(context);
}
完整的示例代码可以在here找到。 我下载了这个项目,它使用的是 .net framework 4.5 但在 .NET Framework 4.6.1 中不再存在 SetContext 方法 我想知道如何在框架版本 4.6.1 中实现相同的功能? 我基本上是在创建一个 OData V3 服务,它将托管在 IIS 中。
【问题讨论】:
标签: asp.net-web-api odata