求教 Enterprise library 2.0问题
我在一个测试项目里的数据层只引用了Microsoft.Practices.EnterpriseLibrary.Data,然后在连接数据库的时候会报一个错“Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory”的类型初始值设定项引发异常
这是我的配置文件
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" />
</configSections>
<dataConfiguration defaultDatabase="Connection String" />
<connectionStrings>
<add name="Connection String" connectionString="Database=pubs;Server=local;Integrated Security=SSPI;uid=sa;pwd=sa;"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
有经验的人士帮我看下啊,在线等,谢谢! --------------------编程问答-------------------- 没有高手帮看下嘛? --------------------编程问答-------------------- dataconfiguration.config
<?xml version="1.0" encoding="utf-8"?>
<dataConfiguration>
<xmlSerializerSection type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null">
<enterpriseLibrary.databaseSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" defaultInstance="Database Instance" xmlns="http://www.microsoft.com/practices/enterpriselibrary/08-31-2004/data">
<databaseTypes>
<databaseType name="Sql Server" type="Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase, Microsoft.Practices.EnterpriseLibrary.Data, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null" />
</databaseTypes>
<instances>
<instance name="Database Instance" type="Sql Server" connectionString="Sql Connection String" />
</instances>
<connectionStrings>
<connectionString name="Sql Connection String">
<parameters>
<parameter name="database" value="" isSensitive="false" />
<parameter name="Integrated Security" value="False" isSensitive="false" />
<parameter name="password" value="" isSensitive="true" />
<parameter name="user id" value="" isSensitive="false" />
<parameter name="server" value="" isSensitive="false" />
</parameters>
</connectionString>
</connectionStrings>
</enterpriseLibrary.databaseSettings>
</xmlSerializerSection>
</dataConfiguration> --------------------编程问答-------------------- To lxwin01(阿幸):
你发的是1.0的版本配置文件,和2.0的配置文件有点不一样
不过,还是要感谢你帮我看下问题 --------------------编程问答-------------------- 问题解决了,还要引用个Microsoft.Practices.ObjectBuilder --------------------编程问答-------------------- Microsoft.Practices.ObjectBuilder
微软的这个东西有好几个版本 有时候真的是会乱套
补充:.NET技术 , C#