I'm trying to use NHibernate to manage my entities in a mono application that uses SQLite for it's database. Every time I try and run the application I get the following error:
Code:
Unhandled Exception: NHibernate.MappingException: Could not compile the mapping document: RugbyManager.Player.hbm.xml ---> System.InvalidOperationException: Could not find the dialect in the configuration
at NHibernate.Dialect.Dialect.GetDialect (IDictionary`2 props) [0x00000] in <filename unknown>:0
at NHibernate.Cfg.Configuration.AddValidatedDocument (NHibernate.Cfg.NamedXmlDocument doc) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at NHibernate.Cfg.Configuration.LogAndThrow (System.Exception exception) [0x00000] in <filename unknown>:0
at NHibernate.Cfg.Configuration.AddValidatedDocument (NHibernate.Cfg.NamedXmlDocument doc) [0x00000] in <filename unknown>:0
at NHibernate.Cfg.Configuration.ProcessMappingsQueue () [0x00000] in <filename unknown>:0
at NHibernate.Cfg.Configuration.AddDocumentThroughQueue (NHibernate.Cfg.NamedXmlDocument document) [0x00000] in <filename unknown>:0
at NHibernate.Cfg.Configuration.AddXmlReader (System.Xml.XmlReader hbmReader, System.String name) [0x00000] in <filename unknown>:0
at NHibernate.Cfg.Configuration.AddInputStream (System.IO.Stream xmlInputStream, System.String name) [0x00000] in <filename unknown>:0
My Nhibernate config is in my App.Config file (which is embedded):
Code:
<configuration>
<!-- Configuration Sections In This File -->
<configSections>
<!-- NHibernate Section -->
<section
name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler,NHibernate"
/>
<!-- NHibernate Configuration -->
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SQLite20Driver</property>
<property name="connection.connection_string">
Data Source=rugbyManager.db,version=3
</property>
<property name="dialect">NHibernate.Dialect.SQLiteDialect</property>
<property name="query.substitutions">true=1;false=0</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
</session-factory>
</hibernate-configuration>
</configSections>
</configuration>
The code I'm using to initialise things is as follows:
Code:
Configuration config = new Configuration();
Assembly thisAssembly = typeof(Player).Assembly;
config.AddAssembly(thisAssembly);
config.Properties.Add("proxyfactory.factory_class", "NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu");
config.Properties.Add("dialect", "NHibernate.Dialect.SQLiteDialect");
config.Configure();
factory = config.BuildSessionFactory();
Is anyone able to explain why this isn't working for me?