【发布时间】:2016-02-16 22:28:27
【问题描述】:
我的存储库中有一个使用实体框架插入数据的方法。我需要将此方法转换为异步方法。我该怎么做?
这是我的方法:
public void movetosecondpost(ProcessingPost processingPost)
{
SuccessPost movedQueue = new SuccessPost();
movedPost.Id = processingPost.Id;
Context.ProcessingPost.Remove(processingPost);
Context.SuccessPost.Add(movedPost);
}
在我的上下文中,我有这两种保存方法:
public override int SaveChanges()
{
return base.SaveChanges();
}
public override Task<int> SaveChangesAsync(CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
return base.SaveChangesAsync(cancellationToken);
}
【问题讨论】:
标签: c# entity-framework asynchronous