【发布时间】:2011-01-06 18:38:51
【问题描述】:
配置 mvc3 和 Nhibernate 时出现以下错误。谁能指导我我错过了什么。
方言未设置。设置属性 hibernate.dialect。 说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:NHibernate.HibernateException:未设置方言。设置属性 hibernate.dialect。
来源错误:
第 16 行:{ 第 17 行:NHibernate.Cfg.Configuration 配置 = new NHibernate.Cfg.Configuration(); 第 18 行:configuration.AddAssembly(System.Reflection.Assembly.GetExecutingAssembly()); 第 19 行: sessionFactory = configuration.BuildSessionFactory(); 第 20 行:}
我的web.config如下:
<configSections> <section name="cachingConfiguration"type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings,Microsoft.Practices.EnterpriseLibrary.Caching"/> <section name="log4net"type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/> <section name="hibernate-configuration"type="NHibernate.Cfg.ConfigurationSectionHandler,NHibernate"/>
<appSettings>
<add key="BusinessObjectAssemblies" value="Keeper.API"></add>
<add key="ConnectionString" value="Server=localhost\SQLSERVER2005;Database=KeeperDev;User=test;Pwd=test;"></add>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.connection_string">Server=localhost\SQLServer2005;Database=KeeperDev;User=test;Pwd=test;</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
</session-factory>
</hibernate-configuration>
【问题讨论】:
-
你试过
NHibernate.Dialect.MsSql2000Dialect, NHibernate
标签: nhibernate asp.net-mvc-2 asp.net-mvc-3