Generate Schema?


Using Fluent NHibernate it's possible to create the schema and even entire database. It'll be so nice if Fluent Linq to Sql can provide a similar functionality.


JeremyS wrote Oct 26, 2009 at 11:39 AM

Linq to SQL already has this built in. The DataContext class has 'CreateDatabase' and 'DropDatabase' methods.


JeremyS wrote Oct 26, 2009 at 11:44 AM

Actually, that should've been 'DeleteDatabase' rather than 'DropDatabase'

Mohamed_Meligy wrote Oct 26, 2009 at 11:49 AM

Yeah. I know that, but how about a Schema update feature? I know this is not easy most probably, and I may investigate how it might be implemented myself, but not sure i have the time this month nor next month.

First try to reflect how CreateDatabase work and get the implementation without DB creation and/or get the script and emit the line that creates the db, but most probably all the lines will be just creating not altering existing or even checking existence, not 100% sure though.

This feature is implemented (as in the docs, I haven't tried yet) in another project "T4 Toolbox" on: http://t4toolbox.codeplex.com/ - this is one possible reference implementation..

JeremyS wrote Oct 26, 2009 at 1:11 PM

In my opinion a schema-update feature is really outside the scope of this project.

You might want to check out one of the migration projects that exists, such as MigratorDotNet (http://code.google.com/p/migratordotnet/) or Tarantino (http://code.google.com/p/tarantino/). I currently use Tarantino to manage schema updates and find this works nicely.


wrote Feb 13, 2013 at 2:55 AM