0

我只是不能得到这个工作!我查看了所有其他相关主题,而且他们都不适合我。这是目前我的连接字符串:EF 5代码优先与SQL Server Express 2012和Visual Studio 2012

<add name='UniContext' connectionString='Server=.\SQLEXPRESS;Database=ContosoUni;Integrated Security=SSPI;User Instance=true' providerName='System.Data.EntityClient'/> 

我得到的错误是:

enter image description here

我将不胜感激任何帮助。

感谢

回答

1

试图改变供应商的名字从System.Data.EntityClient到System.Data.SqlClient的

+0

谢谢尤苏波夫,即摆脱了错误的,但东西是不正确,不表是正在SQL Server Express上的数据库中创建!这是一个截图! [http://goo.gl/znpYT] – Ciwan 2013-02-13 12:43:05

+0

@Ciwan你有初始化策略吗?看看这里http://stackoverflow.com/questions/6281447/ef-code-first-not-generating-tables,你也应该映射你的数据库上下文的类与声明DbSet或使用流利的接口覆盖OnModelCreating方法http://stackoverflow.com/questions/4759004/what-the-purpose-of-onmodelcreating-in-ef4-code-first – Yusupov 2013-02-13 16:01:33

+0

谢谢,我做了以下:[Database.SetInitializer(新的DropCreateDatabaseIfModelChanges ()); ]但仍然没有表正在我的SQL Express数据库中创建! :( – Ciwan 2013-02-15 10:50:34