问题描述
我正在使用带有.Net 4.5的Entity Framework 6。我有一个选择并返回数据的存储过程。返回列之一是地理类型。
I'm using Entity Framework 6 with .Net 4.5. I have a stored procedure that select and returns data. One of the return columns is a geography type.
在Visual Studio 2013中,我右键单击.edmx文件,单击从数据库更新模型...。此操作将获取我的存储过程,并创建一个复杂类型的storeprocedurename_Result。除地理类型外,所有列均以复杂类型对象表示。
In Visual Studio 2013, I right click the .edmx file, click "Update Model From Database...". This action gets my stored procedure and creates a complex type of storeprocedurename_Result. All the columns are represented in the complex type objects except the geography type.
我不想手动修改复杂类型。我想通过单击从数据库更新模型...自动获取它。实体框架6是否支持此功能?实施此功能的步骤是什么?
I don't want to manually modify the complex type. I want to get it automatically via clicking "Update Model From Database...". Does Entity Framework 6 support this? And what are the step to implement this feature?
推荐答案
实体框架不会自动处理此问题,但是添加起来非常简单导入过程后的地理
列。
Entity Framework won't handle this automatically, but it's pretty simple to add the geography
column after the procedure is imported.
-
在模型中浏览器,搜索或导航到存储过程的复杂类型。右键单击,然后选择添加->标量属性->地理位置(或您缺少的任何其他类型):
In the Model Browser, search or navigate to your stored procedure's complex type. Right-click, and select Add -> Scalar Property -> Geography (or any other type that you are missing):
输入列名:
保存模型。
这篇关于存储过程中返回的地理位置列未在Entity Framework自动生成的复杂类型中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!