存储过程中返回的地理位置列未在Entity Framework自动生成的复杂类型中显示 [英] Geography column returned in stored procedure not shown in Entity Framework auto generated complex type

查看:91
本文介绍了存储过程中返回的地理位置列未在Entity Framework自动生成的复杂类型中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有.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.


  1. 在模型中浏览器,搜索或导航到存储过程的复杂类型。右键单击,然后选择添加->标量属性->地理位置(或您缺少的任何其他类型):

  1. 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自动生成的复杂类型中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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