castle 官方文档太郁闷了
IDictionary<string, string> properties = new Dictionary<string, string>();
//sqlserver
properties.Add("connection.driver_class", "NHibernate.Driver.SqlClientDriver");
properties.Add("dialect", "NHibernate.Dialect.MsSql2008Dialect");
properties.Add("connection.connection_string", "UID=sa;Password=mythzz;Initial Catalog=BZ_Ban;Data Source=.");
properties.Add("connection.provider", "NHibernate.Connection.DriverConnectionProvider");
properties.Add("proxyfactory.factory_class", "NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle");
//oracle
//properties.Add("proxyfactory.factory_class", "NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle");
//properties.Add("connection.driver_class", "NHibernate.Driver.OracleClientDriver");
//properties.Add("dialect", "
NHibernate.Dialect.Oracle10gDialect");
//其中官网为OracleDialect,一直报错误([NHibernate.MappingException] = {"Could not compile the mapping document: (string)"}InnerException = {"Could not instantiate dialect class NHibernate.Dialect.Oracle11gDialect"}) ,通过比对mssql产生的xml文件,修改了字段类型都没用,最后看到有的配置里有带版本号,试着加了个版本号居然成功,真让人无语的官方说明文档。
//properties.Add("connection.provider", "NHibernate.Connection.DriverConnectionProvider");
//properties.Add("connection.connection_string", "Data Source=ora3;User ID=mythzz;Password=mythzz;");
properties.Add("dialect", "NHibernate.Dialect.Oracle10gDialect");
properties.Add("connection.provider", "NHibernate.Connection.DriverConnectionProvider");
properties.Add("connection.connection_string", "Data Source=ora3; User ID=mythzz; Password=mythzz");
properties.Add("connection.driver_class", "NHibernate.Driver.OracleClientDriver");
properties.Add("proxyfactory.factory_class", "NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle");
System.Reflection.Assembly ass = System.Reflection.Assembly.Load("Modle");
InPlaceConfigurationSource source = new InPlaceConfigurationSource();
source.Add(typeof(ActiveRecordBase), properties);
ActiveRecordStarter.Initialize(ass, source);