开发者

Could not compile the mapping document, Could not instantiate dialect class Nhibernate.Dialect.MsSql2008Dialect

I am using Visual Studio 2010 with NHibernate 3.2.0.GA, I do have a web application with the following Web.Config File:

<?xml version="1.0"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
  <configSections>
    <section name="hibernate-configuration"
             type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
  </configSections>
  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory name ="Nhibernate.Test">
      <property name="connection.driver_class">
                NHibernate.Driver.SqlClientDriver</property>
      <property name="connection.connection_string">
        Data Source=.\SQLEXPRESS;AttachDbFilename=开发者_如何学CC:\Users\Mahshid\Desktop\BugTracker\BugTracker\App_Data\BugTrackerDB.mdf;
        Integrated Security=True;User Instance=True
      </property>
      <property name ="adonet.batch_size">10</property>
      <property name="show_sql">true</property>
      <property name="dialect">Nhibernate.Dialect.MsSql2008Dialect</property>
      <property name="command_timeout">60</property>
      <property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
      <property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory,
                                                  NHiberante.ByteCode.LinFu</property>
    </session-factory>
  </hibernate-configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
</configuration>

I added my sql database as a local one inside vs2010, I also do have two nhibernate hbm.xml files with as follows:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   namespace="BugTracker.Model"
                    assembly ="BugTracker">
  <class name="Bug" table ="Bugs" lazy="false">

    <id name ="BugId" column ="BugId" type="int"
         unsaved-value="0">
      <generator class="native"/>
    </id>

    <property name="Desc" column="Description"/>

    <property name="Fixed" column ="Fixed"/>

    <many-to-one  name="Application"
                  class="Application"
                  column="ApplicationId"
                  cascade="all"
                  not-null="true"/>
  </class>
</hibernate-mapping>

And:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="BugTracker.Model"
                   assembly="BugTracker">
  <class name="Application" table="Applications" lazy="false">
    <id name="ApplicationId" column ="ApplicationId" type="int" unsaved-value ="0">
      <generator class ="native"></generator>
    </id>

    <property name ="Name" column="Name"/>

    <component access ="field.camelcase-underscore" name ="Developer"
               class="Developer">
      <property access ="field.camelcase-underscore" 
                column ="DeveloperFirstName" name="FirstName"/>
      <property access ="field.camelcase-underscore" 
                column="DeveloperLastName" name="LastName"/>
    </component>

    <bag cascade="all-delete-orphan"
          inverse ="true"
          name ="Bugs"
          lazy="false"
          access ="field.camelcase-underscore">
      <key column ="ApplicationId"/>
      <one-to-many class ="Bug"/>
    </bag>

  </class>
</hibernate-mapping>

I set them as embedded resource, believe me but I get the exception in the following code part:

private static void Init()
{
    NHibernate.Cfg.Configuration config;

    config = new NHibernate.Cfg.Configuration();
    config.AddAssembly("BugTracker");
    config.Configure();

    _SessionFactory = config.BuildSessionFactory();
}

With this message:

Could not compile the mapping document: BugTracker.Model.Bug.hbm.xml

Inner Exception Message:

Could not instantiate dialect class Nhibernate.Dialect.MsSql2008Dialect

I know that this is beginer's issue but i am just a newbie! but i appreciate your ideas...


Shouldn't the name of dialect be NHibernate.Dialect.MsSql2008Dialect? I mean H must be capital?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜