我有两个项目 Portfolio.Domain 和 Portfolio.Web。我在 Portfolio.Web 中添加了参考 Portfolio.Domain 我需要首先使用代码。但出现错误:
The type 'Portfolio.Domain.Context, Portfolio.Domain' could not be found. The type name must be an assembly-qualified name.
网络配置:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=152368
-->
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<connectionStrings>
<add name="DataContext" providerName="System.Data.SqlClient" connectionString="Data Source=USER\SQLEXPRESS;Initial Catalog=Portfolio;Integrated Security=True;Pooling=False;User Instance = False;MultipleActiveResultSets=true" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="1.0.0.0" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="DatabaseInitializerForType Portfolio.Domain.Context, Portfolio.Domain" value="Portfolio.Web.Context.DataContextInitializer, Portfolio.Web" />
</appSettings>
<system.web>
<!--Replace your existing membership config with this one-->
<membership defaultProvider="CodeFirstMembershipProvider">
<providers>
<add name="CodeFirstMembershipProvider" type="CodeFirstMembershipSharp.CodeFirstMembershipProvider" connectionStringName="DataContext" />
</providers>
</membership>
<!--Profile provider not supported, extend your code with Code-First-->
<profile enabled="false">
<providers>
<clear />
</providers>
</profile>
<!--Replace your existing roleManager config with this one-->
<roleManager enabled="true" defaultProvider="CodeFirstRoleProvider">
<providers>
<clear />
<add name="CodeFirstRoleProvider" type="CodeFirstMembershipSharp.CodeFirstRoleProvider" connectionStringName="DataContext" />
</providers>
</roleManager>
<!--compilation-->
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
<!--pages-->
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<!--<runtime>-->
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
<parameters>
<parameter value="Data Source=USER\SQLEXPRESS;Initial Catalog=Portfolio;Integrated Security=True;Pooling=False;User Instance = False;MultipleActiveResultSets=true" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
</configuration>