尝试使用脚手架添加控制器并收到错误。似乎与我的连接字符串有关。
"unable to retrieve metadata for DOTNETMEMBER.Song. Failed to set database initializer type of type DOTNET.DataContextInitializer, DOTNETMEMBER' specified in the application configuration. Entries should be in the form of 'key=DatabaseInitializerForType MyNamespace.MydbContextClass, MyAssembly'.
初始化类必须有无参数构造函数。有关详细信息,请参阅内部异常。
这是我的连接字符串
<connectionStrings>
<add name="DataContext"
connectionString="Data Source=|DataDirectory|RTDOTNETMEMBER.sdf"
providerName="System.Data.SqlServerCe.4.0" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="1.0.0.0"/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
<!--Used to initialize the database-->
<add key="DatabaseInitializerForType DOTNET.DataContext, DOTNETMEMBER" value="DOTNET.DataContextInitializer, DOTNETMEMBER" />
</appSettings>
是因为 SQL Compact 吗?