C# 配置中的NHibernate无法看到任何内容

C# 配置中的NHibernate无法看到任何内容,c#,nhibernate,configuration,nhibernate-mapping,C#,Nhibernate,Configuration,Nhibernate Mapping,我需要帮助配置NHibernate。在我的解决方案中有几个项目:第一个包含代码实体,第二个包含映射文件“*.hbm.xml” 我通过代码进行配置。这是: Configuration config = new Configuration(). Proxy(proxy => proxy.ProxyFactoryFactory<ProxyFactoryFactory>()). DataBaseIntegration(db =>

我需要帮助配置NHibernate。在我的解决方案中有几个项目:第一个包含代码实体,第二个包含映射文件“*.hbm.xml”

我通过代码进行配置。这是:

    Configuration config = new Configuration().
        Proxy(proxy => proxy.ProxyFactoryFactory<ProxyFactoryFactory>()).
        DataBaseIntegration(db =>
                                {
                                    db.Dialect<MsSql2008Dialect>();
                                    db.ConnectionString = @"Data Source=(local)\SQLEXPRESS;Initial Catalog=MyDB;Integrated Security=True;Pooling=False";
                                    db.BatchSize = 100;
                                }).AddAssembly("MyProject.DAL.Mappings");
此代码创建一个空文件:

SchemaExport schemaExport = new SchemaExport(configuration);
schemaExport.SetOutputFile(@"db.sql").Execute(false, false, false);
NHibernate似乎无法“拾取”映射文件。为什么?


提前谢谢

由于映射文件位于单独的文件夹中,nhibernate无法看到它们。由
配置决定。AddDirectory()

SchemaExport schemaExport = new SchemaExport(configuration);
schemaExport.SetOutputFile(@"db.sql").Execute(false, false, false);