2011-07-22 20 views
0

NHibernate 3.2.0.GAでVisual Studio 2010を使用しています.Webアプリケーションに次のWeb.Configファイルがあります。マッピングドキュメントをコンパイルできませんでした。ダイアレクトクラスをインスタンス化できませんでした。Nhibernate.Dialect.MsSql2008Dialect

<?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=C:\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> 

私はVS2010内のローカル一人として、私のSQLデータベースを追加して、私はまた、次のように2つのNHibernateのhbm.xmlファイルが持っている:

<?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> 

そして:

<?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> 

私は、埋め込みリソースとして、それらを設定し、私を信じているが、私は次のコードの一部に例外を取得:

このメッセージでは
private static void Init() 
{ 
    NHibernate.Cfg.Configuration config; 

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

    _SessionFactory = config.BuildSessionFactory(); 
} 

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

内部例外メッセージ:

Could not instantiate dialect class Nhibernate.Dialect.MsSql2008Dialect 

これは初心者の問題ですが、私は初心者です!しかし私はあなたのアイデアを高く評価しています...

答えて

1

NHibernate.Dialect.MsSql2008Dialectの名前はありませんか?私はHが資本でなければならないということですか?

+0

ヒント:逆引用符を使用してインラインコード –

+0

@David Kempを使用することができます - ありがとう、それを念頭に置いてください。 –

関連する問題