加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 关键字不支持:’元数据’.使用MVC3的Entityt框架中

发布时间:2020-12-15 23:31:02 所属栏目:asp.Net 来源:网络整理
导读:我正在使用我的Asp.Net MVC3应用程序的实体框架4.我的问题是我正在使用Entity Framework对我的数据库执行操作,这是正常的.为了其他目的,我还使用Sql Connection来存储和检索数据库中的数据.我正进入(状态 [Keyword not supported: 'metadata'] 连接我的数据
我正在使用我的Asp.Net MVC3应用程序的实体框架4.我的问题是我正在使用Entity Framework对我的数据库执行操作,这是正常的.为了其他目的,我还使用Sql Connection来存储和检索数据库中的数据.我正进入(状态
[Keyword not supported: 'metadata']

连接我的数据库时出错.

这是我的网络配置

<add name="VibrantEntities" connectionString="metadata=res://*/Vibrant.csdl|res://*/Vibrant.ssdl|res://*/Vibrant.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=KAPS-PCKAPSSERVER;initial catalog=vibrant;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

我正在使用类库,所以这是我的App Config.

<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,EntityFramework,Version=4.3.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089" />

   <add name="VibrantEntities" connectionString="metadata=res://*/Vibrant.csdl|res://*/Vibrant.ssdl|res://*/Vibrant.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=KAPS-PCKAPSSERVER;initial catalog=vibrant;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

解决方法

ADO.NET(在本例中为SqlConnection)的连接字符串不采用该格式.您正在使用一个特定于实体框架的实体框架. ADO.NET应该是这样的:
"data source=KAPS-PCKAPSSERVER;initial catalog=vibrant;integrated security=True"

因此,总结一下,您需要两个独立的连接字符串,一个用于EF,另一个用于ADO.NET

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读