将 EntityFramework 设置放入另一个配置文件
Put EntityFramework Settings to another config file
我想划分我的 web.config ,有些部分可以使用 configSource 属性来划分,比如 httphandler 或 appsettings.I 也想将 entity framework 设置分开到不同的 config.file.Is这可能吗?
<httpHandlers configSource="ConfigurationFiles\Settings\Web.HttpHandlers.config" />
> <entityFramework>
> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory,
> EntityFramework">
> <parameters>
> <parameter value="v11.0" />
> </parameters>
> </defaultConnectionFactory>
> <providers>
> <provider invariantName="Oracle.DataAccess.Client" type="Oracle.DataAccess.EntityFramework.EFOracleProviderServices,
> Oracle.DataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral,
> PublicKeyToken=89b483f429c47342" />
> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices,
> EntityFramework.SqlServer" />
> </providers> </entityFramework>
是的,就像您对 httpHandlers
所做的一样,例如:
<entityFramework configSource="ConfigurationFiles\Settings\EntityFramework.config" />
并且在 ConfigurationFiles\Settings\EntityFramework.config
文件中:
<entityFramework>
<!-- etc..... -->
</entityFramework>
我想划分我的 web.config ,有些部分可以使用 configSource 属性来划分,比如 httphandler 或 appsettings.I 也想将 entity framework 设置分开到不同的 config.file.Is这可能吗?
<httpHandlers configSource="ConfigurationFiles\Settings\Web.HttpHandlers.config" />
> <entityFramework>
> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory,
> EntityFramework">
> <parameters>
> <parameter value="v11.0" />
> </parameters>
> </defaultConnectionFactory>
> <providers>
> <provider invariantName="Oracle.DataAccess.Client" type="Oracle.DataAccess.EntityFramework.EFOracleProviderServices,
> Oracle.DataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral,
> PublicKeyToken=89b483f429c47342" />
> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices,
> EntityFramework.SqlServer" />
> </providers> </entityFramework>
是的,就像您对 httpHandlers
所做的一样,例如:
<entityFramework configSource="ConfigurationFiles\Settings\EntityFramework.config" />
并且在 ConfigurationFiles\Settings\EntityFramework.config
文件中:
<entityFramework>
<!-- etc..... -->
</entityFramework>