【发布时间】:2011-02-26 11:59:11
【问题描述】:
我目前正在为 HNibernate 创建一个自定义连接提供程序,与提到的here 非常相似。在其中,他们在 hibernate.cfg.xml 参数中指定了一个单独的连接字符串。但是,当我去添加这个新参数时,像这样......
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory>
<property name="connection.provider">MyNameSpace.FailoverConnectionProvider</property>
<property name="dialect">NHibernate.Dialect.MsSql2008Dialect,NHibernate</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">[primary connection string]</property>
<property name="connection.failover_connection_string">[failover connection string]</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
...
</session-factory>
</hibernate-configuration>
...我收到了这条异常消息:
InnerException {"The 'name' attribute is invalid - The value 'connection.failover_connection_string' is invalid according to its datatype 'String' - The Enumeration constraint failed."} System.Exception {System.Xml.Schema.XmlSchemaValidationException}
我的问题是:是否可以将自定义属性添加到 NHibernate 配置文件中?如果有,怎么做?
谢谢!
【问题讨论】:
标签: c# nhibernate configuration xsd