Entity Framework Core 1.0 CurrentValues.SetValues() 不存在 [英] Entity Framework Core 1.0 CurrentValues.SetValues() does not exist

查看:14
本文介绍了Entity Framework Core 1.0 CurrentValues.SetValues() 不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Entity Framework Core 1.0 RC 1 更新实体及其相关的子实体,其中实体与 DbContext 分离.我之前使用过类似于此答案中描述的解决方案.

I'm attempting to update an entity and its related child entities using Entity Framework Core 1.0 RC 1, where the entities are detached from DbContext. I've done this previously using a solution similar to the one described in this answer.

但是,我们似乎不再能够使用 Entity Framework 7 执行以下操作:

However, it seems that we are no longer able to do the following using Entity Framework 7:

DbContext.Entry(existingPhoneNumber).CurrentValues.SetValues();

Visual Studio 抱怨:

Visual Studio complains that:

EntityEntry 不包含CurrentValues"的定义等等...

EntityEntry does not contain a definition for 'CurrentValues' etc...

我认为这意味着这还没有(还?)为 EF Core 1.0 实现?除了手动更新属性,还有没有其他解决办法?

I presume this means that this has not (yet?) been implemented for EF Core 1.0? Apart from manually updating the properties, is there any other solution?

推荐答案

您已经注意到,EF Core 中尚未实现此 API.请参阅此工作项:https://github.com/aspnet/EntityFramework/issues/1200

As you have noticed, this API is not implemented yet in EF Core. See this work item: https://github.com/aspnet/EntityFramework/issues/1200

这篇关于Entity Framework Core 1.0 CurrentValues.SetValues() 不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆