实体框架核心1.0 CurrentValues.SetValues()不存在 [英] Entity Framework Core 1.0 CurrentValues.SetValues() does not exist

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

问题描述

我正在尝试使用Entity Framework Core 1.0 RC 1更新实体及其相关的子实体,其中实体与DbContext分离。我以前使用的解决方案类似于 answer 中所述的解决方案。

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

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

Visual Studio抱怨:


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


我认为表示尚未(尚未?)针对EF Core 1.0实施?除了手动更新属性外,还有其他解决方案吗?

解决方案

您已经注意到,该API尚未在EF核心。请参阅以下工作项: https://github.com/aspnet/EntityFramework/issues/1200


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.

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

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

Visual Studio complains that:

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

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?

解决方案

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

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

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