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?
1 Answer
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);
1 Comment
Markus
Is there anyway to do it without clearing all current data?