【发布时间】:2013-07-04 00:18:56
【问题描述】:
我一直在尝试使用带有代码优先迁移的 SQL Server 数据库。对于我最近的尝试,我:
- 创建了一个新的 ASP.NET MVC 4 Web 应用程序项目(是的,我想使用这个模板)
- 创建模型实体
- 创建了继承自 dbcontext 的数据上下文类
-
将以下连接字符串放置在应用程序根目录中的 Web.config 中:
add name="DefaultConnection" connectionString="Data Source=.\sqlexpress;Integrated Security=true;Initial Catalog=DatingAnAsianWoman;MultipleActiveResultSets=true;providerName=System.Data.SqlClient" -
在包管理器中我输入:
Enable-Migrations -ContextTypeName UsersContext -
接着是:
Update-Database
此时我收到以下错误:
The connection string 'DefaultConnection' in the application's configuration file does not contain the required providerName attribute."
如果有任何帮助,我将不胜感激。
【问题讨论】:
标签: asp.net-mvc-4 visual-studio-2012 entity-framework-5 entity-framework-migrations sql-server-2012-express