I'm very new at this, but I need to create new tables from existing classes without creating them by hand. Can this be done using a tool or command line?
Yes, with nhibernate you can generate and update schemas automatically.
var cfg = new Configuration();
cfg.Configure();
cfg.AddAssembly(typeof (aClassFromYourProject).Assembly);
new SchemaExport(cfg).Execute(false, true, false, false);
Update: The overload options for SchemaExport.Execute have changed in the 3.x versions. The last argument is no longer needed.
new SchemaExport(cfg).Execute(true, true, false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With