Asp MVC与MYSQL实体框架 [英] Asp MVC with MYSQL entity framework
本文介绍了Asp MVC与MYSQL实体框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在MYSQL中有两个实体使用实体框架6.1.3v
这是我的配置文件相对内容
< connectionStrings >
< add name = db_aia_rcsEntities connectionString = metadata = res://*/DB.AIAEntitiesMySQL.csdl | res://*/DB.AIAEntitiesMySQL.ssdl | res://*/DB.AIAEntitiesMySQL.msl; provider = MySql.Data.MySqlClient; provider connection string = server = 本地主机;用户 id = root; database = db_aia_rcs providerName < span class =code-keyword> = System.Data.EntityClient < span class =code-keyword> / >
< add name = aia_ursEntities connectionString = metadata = res ://*/DB.ModelUrs.csdl | res://*/DB.ModelUrs.ssdl | res://*/DB.ModelUrs.msl; provider = MySql.Data.MySqlClient; provider connection string = server = localhost; user < span class =code-attribute> id = root; persistsecurityinfo = True; database = aia_urs providerName = System.Data.EntityClient / >
< / connectionStrings >
< entityFramework >
< defaultConnectionFactory 类型 = System.Data.Entity.Infrastructure.LocalDbConnectionFactory,EntityFramework >
< 参数 >
< ; 参数 value < span class =code-keyword> = v12.0 / >
< /参数 >
< / defaultConnectionFactory >
< 提供商 >
< provider invariantName = MySql.Data.MySqlClient type = MySql.Data.MySqlClient.MySqlProviderServices / >
< / providers >
< / entityFramework >
运行系统时我得到了这个错误
屏幕截图
感谢提前!
我尝试过:
我删除并重新创建两个模型但得到相同的错误没有运气
解决方案
我没有尝试过使用MySQL和EF ,但我希望这个简短的讨论有所帮助:使用MySQL的Enity框架 - 堆栈溢出 [ ^ ]
您还可以查看有关如何正确连接MySQ的文档L与EF6: MySQL ::连接器和API手册:: 5.8.1实体框架6支持 [ ^
I Have Two Entity in MYSQL Using Entity Framework 6.1.3v
This is My Configuration File Relative Content
<connectionStrings>
<add name="db_aia_rcsEntities" connectionString="metadata=res://*/DB.AIAEntitiesMySQL.csdl|res://*/DB.AIAEntitiesMySQL.ssdl|res://*/DB.AIAEntitiesMySQL.msl;provider=MySql.Data.MySqlClient;provider connection string="server=localhost;user id=root;database=db_aia_rcs"" providerName="System.Data.EntityClient" />
<add name="aia_ursEntities" connectionString="metadata=res://*/DB.ModelUrs.csdl|res://*/DB.ModelUrs.ssdl|res://*/DB.ModelUrs.msl;provider=MySql.Data.MySqlClient;provider connection string="server=localhost;user id=root;persistsecurityinfo=True;database=aia_urs"" providerName="System.Data.EntityClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v12.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices" />
</providers>
</entityFramework>
When Run the System I got This Error
Screen Shot Here
Thank In Advance!
What I have tried:
I Delete And Re Create Two Models But get the Same Error No Luck
解决方案
I haven't tried using MySQL with EF, but I hope this short discussion helps: Enity Framework With MySQL - Stack Overflow[^]
You can also check this documentation on how to properly connect MySQL with EF6: MySQL :: Connectors and APIs Manual :: 5.8.1 Entity Framework 6 Support[^]
这篇关于Asp MVC与MYSQL实体框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文