如何获取实体框架来更新复杂类型? [英] How Do I Get Entity Framework To Update Complex Types?
问题描述
我正在使用实体框架(EF)从存储过程中创建复杂类型。最近,存储过程发生了变化(添加了更多的返回值。我想更新映射到该存储过程的复杂类型。这是否可能,如果可以,怎么办?我当前每次删除函数import和complex type时存储过程更改,这很可能不是最好的方法。
I'm using the Entity Framework (EF) to create a complex type from a stored procedure. Recently, the stored procedure changed (more return values were added. I would like to update the complex type that maps to this stored procedure. Is this possible and if so, how? I am currently deleting my function import and complex type each time a stored procedure changes, which is most likely not the best approach.
推荐答案
我发现了另一种不删除复杂类型的方法您可以更新您的Complex Type,Visual Studio会添加所有更改的列。方法如下:
I found another way of doing this without deleting the complex type. You can update your Complex Type and Visual Studio will add any changed columns. Here's how:
- 打开.edmx文件,然后转到
- 如果存储的过程已更改,请在模型浏览器中的任何空白区域上单击鼠标右键,然后选择从数据库更新模型,单击完成,这将刷新您的存储过程。
- 现在向下钻取到XModel.edmx> XModel> EntityContainer:XEntities>函数导入(X是您的实体名称),然后右键单击您需要更新的那个,选择Edit。 / li>
- C点击获取列信息。现在,在复杂类型单选按钮旁边,有一个更新按钮。
应该这样做!
这篇关于如何获取实体框架来更新复杂类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!