我使用EF构建应用程序。 我尝试从名为“GuestMenu”的表单继承,该表单使用名为“UserEntities2”的EF模型。 当我尝试观看我继承的表单设计器(“MemberMenu”)时,我看到以下错误:
在。中找不到名为'UserEntities2'的连接字符串 应用程序配置文件。
app.config文件有连接字符串,只有在使用继承时才会看到此错误。
什么可能导致这个问题?
会员菜单表格:
public partial class MemberMenu : GuestMenu
{
public MemberMenu()
{
InitializeComponent();
}
}
app.config文件:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<connectionStrings>
<add name="UserModel" connectionString="data source=ITAY-PC;initial catalog=finalDB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
<add name="Project23.Properties.Settings.finalDBConnectionString" connectionString="Data Source=ITAY-PC;Initial Catalog=finalDB;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="Project23.Properties.Settings.finalDBConnectionString1" connectionString="Data Source=TZAHINAKASH;Initial Catalog=finalDB;Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework" providerName="System.Data.SqlClient" />
<add name="UserEntities2" connectionString="metadata=res://*/UserEntities.csdl|res://*/UserEntities.ssdl|res://*/UserEntities.msl;provider=System.Data.SqlClient;provider connection string="data source=**;initial catalog=***;persist security info=True;user id=**;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" `type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />`
</providers>
</entityFramework>
</configuration>
谢谢!