views:

38

answers:

2
var cfg = new Configuration();
cfg.Configure();
cfg.AddAssembly(typeof(<ClassName>).Assembly);
new SchemaExport(cfg).Execute(false, true, false, false);

The above piece of code is supposed to create a database Table with name

But it is not creating...

Can someone help me out on this...

It is very urgent...

+2  A: 

Your most likely problems:

  • using SQLite with connection.release_mode=on_close
  • no mapping files in the specified assembly
  • mapping files have not been added to the assembly as an Embedded Resource
  • mapping files are not named *.hbm.xml
  • some table or column names should be quoted for SQL (this would be throwing an exception)
Lachlan Roche
A: 

Is this pure NHibernate or also FluentNHibernate. Where do you provide your ISessionFactory and if it is created automatically, are you sure that your config is right so the cfg.Configure() method creates the ISessionFactory?

Best Regards,
Oliver Hanappi

Oliver Hanappi
cfg.AddAssembly() suggests that OP is not using FluentNHibernate.
Lachlan Roche