0

I need help with configuring NHibernate. In my solution has several projects: first contains the code entity, second contains the mapping files "*.hbm.xml".

I configure through code. Here it is:

    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");

This code does not create tables in the database:

SchemaExport schemaExport = new SchemaExport(configuration);
schemaExport.Create(false, true);

This code creates an empty file:

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

It seems that NHibernate can not "pick up" mapping files. Why?

Thanks in advance!

Kovpaev Alexey
  • 1,725
  • 6
  • 19
  • 38

1 Answers1

0

Since the mapping files were in a separate folder - nhibernate could not see them. Decided by Configuration.AddDirectory().

Kovpaev Alexey
  • 1,725
  • 6
  • 19
  • 38