使用VS 11,.NET 4.5和实体框架时生成错误 [英] Build error when using VS 11, .NET 4.5 and Entity Framework

查看:184
本文介绍了使用VS 11,.NET 4.5和实体框架时生成错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio 2010中,我的解决方案是使用.NET 4.2(实体框架2011年6月CTP),所以我可以在实体框架中使用空间类型。当我升级到Visual Studio 11 Beta时,由于4.2和4.5框架之间的冲突,所以不会构建,所以我卸载了4.2。现在我在构建时收到这个错误:


错误209:目前,空间类型仅在使用了具有UseStrongSpatialTypes的CSDL文件时被支持任何人都知道这是什么意思,我可以做些什么?


解决方案

手动编辑.edmx文件对我有用。在文本或XML编辑器中打开文件(您可以右键单击并打开...)



转到ConceptualModels中的模式节点,然后更改:

 < edmx:ConceptualModels> 
< Schema Namespace =MyDataModelAlias =Selfxmlns =http://schemas.microsoft.com/ado/2009/11/edm>
...

添加属性,如下所示:

 < edmx:ConceptualModels> 
< Schema Namespace =MyDataModelAlias =Selfxmlns =http://schemas.microsoft.com/ado/2009/11/edmxmlns:annotation =http://schemas.microsoft .com / ado / 2009/02 / edm / annotation注释:UseStrongSpatialTypes =false>

这是非常烦人的这个属性是不可编辑的。


In Visual Studio 2010, my solution was using .NET 4.2 (Entity Framework June 2011 CTP) so I could use spatial types in Entity Framework. When I upgraded to Visual Studio 11 Beta, it wouldn't build because of conflicts between the 4.2 and 4.5 framework so I uninstalled 4.2. Now I get this error when I build:

Error 209: Currently, spatial types are only supported when used in CSDL files that have the UseStrongSpatialTypes annotation with a false value on their root Schema element.

Anyone know what this means and what I can do about it? Google yields literally zero results ...

解决方案

Manually editing the .edmx file worked for me. Open the file in text or XML editor(you can right click and open with...)

Go to Schema node in ConceptualModels and change this:

<edmx:ConceptualModels>
    <Schema Namespace="MyDataModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
    ...

to add the attribute, like so:

<edmx:ConceptualModels>
  <Schema Namespace="MyDataModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2009/11/edm"  xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" annotation:UseStrongSpatialTypes="false">

It is quite annoying this attribute is not editable.

这篇关于使用VS 11,.NET 4.5和实体框架时生成错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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