Geography column returned in stored procedure not shown in Entity Framework auto generated complex type

牧云@^-^@ 提交于 2019-12-02 00:21:49

问题


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.

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.

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?


回答1:


Entity Framework won't handle this automatically, but it's pretty simple to add the geography column after the procedure is imported.

  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):

  2. Enter the name of your column:

  3. Save your model.



来源:https://stackoverflow.com/questions/28592085/geography-column-returned-in-stored-procedure-not-shown-in-entity-framework-auto

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!