I've got the following mapping in my application. The mapping is generated, by a custom tool. Other mappings generated work ok, but this one is giving me a strange error which I don't understand.
This is the mapping;
<?xml version="1.0" encoding="utf-8"?>
<!--Generated by NHibernate.Mapping.Attributes on 2010-10-29 08:39:48Z.-->
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Plugin.Twitter.Business.Entities.Tweet, Plugin.Twitter" table="PluginTwitter_Tweet">
<id name="Id" column="Id">
<generator class="guid" />
</id>
<property name="TweetMessage" />
<property name="TweetDate" />
<property name="TweetId" />
</class>
</hibernate-mapping>
This is the error which i'm getting in the browser when i trying to open the website containing the mapping file;
The stacktrace with it is as below;
[InvalidOperationException: Could not find the dialect in the configuration]
NHibernate.Dialect.Dialect.GetDialect(IDictionary 2 props) +204
NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc) +155
[MappingException: Could not compile the mapping document: Plugin.Twitter.Business.Entities.Hbm.Tweet.hbm.xml]
NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc) +534
NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String name) +378
NHibernate.Cfg.Configuration.AddResource(String path, Assembly assembly) +419
NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly) +355
NHibernate.Cfg.Configuration.AddAssembly(String assemblyName) +291
CMS.ResourceAccess.DataAccessLogic.SessionManagement.SessionManager..ctor() in C:\Projects\Website\Website.ResourceAccess\DataAccessLogic\SessionManagement\SessionManager.cs:73
Website.ResourceAccess.DataAccessLogic.SessionManagement.NestedSessionManager..cctor() in C:\Projects\Website\Website.ResourceAccess\DataAccessLogic\SessionManagement\SessionManager.cs:90
[TypeInitializationException: The type initializer for 'NestedSessionManager' threw an exception.]
Website.ResourceAccess.DataAccessLogic.SessionManagement.SessionManager.get_Instance() in C:\Projects\Website\Website.ResourceAccess\DataAccessLogic\SessionManagement\SessionManager.cs:39
CMS.ResourceAccess.DataAccessLogic.SessionManagement.SessionManager.get_SessionFactory() in C:\Projects\Website\Website.ResourceAccess\DataAccessLogic\SessionManagement\SessionManager.cs:23
Website.Backend.MvcApplication.StartNHibernateSession() in C:\Projects\Website\Website.Web\Global.asax.cs:82
Website.Backend.MvcApplication.Application_Start() in C:\Projects\Website\Website.Web\Global.asax.cs:47
[HttpException (0x80004005): The type initializer for 'NestedSessionManager' threw an exception.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +3988565
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +325
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375
[HttpException (0x80004005): The type initializer for 'NestedSessionManager' threw an exception.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11529072
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4784373
I think the import thing to notice is that the exception i'm getting is an mapping exception as shown with this rule;
MappingException: Could not compile the mapping document: Plugin.Twitter.Business.Entities.Hbm.Tweet.hbm.xml]
I don't understand how and why though so I hope someone can tell me what the error means and how I can fix this issue. I've got the mapping marked as embedded resource.
UPDATE: We're using the following hibernate.cfg.xml file in the application.
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns='urn:nhibernate-configuration-2.2'>
<session-factory>
<property name="show_sql">true</property>
<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string_name">NHibernate</property>
<property name="current_session_context_class">managed_web</property>
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
<!--Needed for NH Profiler-->
<property name="generate_statistics">false</property>
</session-factory>
</hibernate-configuration>