指定的架构无效。错误:“ System.Data.Spatial.DbGeography”无法映射到原始类型 [英] Schema specified is not valid. Errors: 'System.Data.Spatial.DbGeography' which cannot be mapped to a primitive type

查看:139
本文介绍了指定的架构无效。错误:“ System.Data.Spatial.DbGeography”无法映射到原始类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我首先要做的是Entity Framework(v6)数据库。尝试从我的数据上下文访问数据时出现以下错误。
因为类型'Model.Table1'不可用,所以未加载关系'Model.FK_Table1_Table2'。
以下信息可能有助于解决上一个错误:
类型 Model.Table1上的属性 Location具有属性类型 System.Data.Spatial.DbGeography,不能

I'm doing Entity Framework (v6) db first. I get the following error when trying to access data from my datacontext. The relationship 'Model.FK_Table1_Table2' was not loaded because the type 'Model.Table1' is not available. The following information may be useful in resolving the previous error: The property 'Location' on the type 'Model.Table1' has a property type of 'System.Data.Spatial.DbGeography' which cannot be mapped to a primitive type.

任何想法导致此错误的原因是什么?

Any idea what is causing this error?

推荐答案

我不知道这是否是您的问题,但是当我从EF5升级到EF6时,我遇到了类似的错误。空间数据类型移动了名称空间。该链接具有所有信息:

I don't know if this is your problem, but I had a similar error when I upgraded from EF5 to EF6. The spatial data types moved namespaces. This link has all the info:

http://msdn.microsoft.com/zh-CN/data/dn469466

简而言之,您需要:


  1. 安装EF6

  2. 更新任何名称空间/使用语句

  3. 删除对系统的引用.Data.Entity

  4. (可能)刷新您的EF图。

  1. Install EF6
  2. Update any namespace/using statements
  3. Remove references to System.Data.Entity
  4. (Probably) refresh your EF diagram.

这篇关于指定的架构无效。错误:“ System.Data.Spatial.DbGeography”无法映射到原始类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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