More info: It seems that as soon as I use a date type from the NHibernate namespace, when I call Juan Carlos Seguí - CAE escribió:
XmlConfigurationSource config = new XmlConfigurationSource("nhibernate.config"); It somehow calls internally InPlaceConfigurationSource. In InPlaceConfigurationSource.cs we can read: /// <summary> /// Enum for database types support for configuration construction. /// Not to be confused by databases supported by ActiveRecord /// </summary> public enum DatabaseType { /// <summary> /// Microsoft SQL Server 2005 /// </summary> MSSQLServer2005, /// <summary> /// Microsoft SQL Server 2000 /// </summary> MSSQLServer2000 } So it seems that InPlaceConfigurationSource only supports MS SQL Server 2000 and 2005 dialects. Why is the XmlConfigurationSource calling InPlaceConfigurationSource?? What am I doing wrong? > Hi all, > > I've an assembly for all of my models that maps to two different > databases using ActiveRecord. This assembly is called from a console > application for testing purposes. All is fine if I only use > ActiveRecord, but as soon as I use some data type from NHibernate > namespace the console application fails at the first line of code: > > XmlConfigurationSource config = new > XmlConfigurationSource("nhibernate.config"); > > This line throws a NullReferenceException (without any additional info). > The model's assembly has references to both NHibernate and ActiveRecord > assemblies. The console application has the following nhibernate.config > file: > > <activerecord isWeb="false"> > > <config type="Cae.Internal.Models.AdministrationDatabase`1, > Cae.Internal.Models"> > <add key="connection.driver_class" > value="NHibernate.Driver.NpgsqlDriver" /> > <add key="dialect" value="NHibernate.Dialect.PostgreSQLDialect" /> > <add key="connection.provider" > value="NHibernate.Connection.DriverConnectionProvider" /> > <add key="connection.connection_string" > value="Server=localhost;Database=test;User > ID=test;Password=test;Encoding=SQL_ASCII" /> > </config> > > <config type="Cae.Internal.Models.InvoicingDatabase`1, > Cae.Internal.Models"> > <add key="connection.driver_class" > value="NHibernate.Driver.MySqlDataDriver" /> > <add key="dialect" value="NHibernate.Dialect.MySQLDialect" /> > <add key="connection.provider" > value="NHibernate.Connection.DriverConnectionProvider" /> > <add key="connection.connection_string" value="Data > Source=localhost;Database=test;User ID=test;Password=test" /> > </config> > > </activerecord> > > If I don't use any data types from NHibernate namespace all is fine, but > I need to use DetachedCriteria :( > > In the model assembly I'm using ActiveRecordBase<T> as the base class > for my different abstract classes to use multiple databases, ie: > > [ActiveRecord] > public abstract class AdministrationDatabase<T> : ActiveRecordBase<T> > { > } > > Does somebody have an idea of where is the problem? > > Thank you > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to castle-project-users@googlegroups.com To unsubscribe from this group, send email to castle-project-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---