Thursday, October 14, 2010

NHibernate Schema Export in Suteki Shop

Using the NHibernate Schema Export makes the initial database creation experience for Suteki Shop really slick. All you have to do now is run a little console app:

All the initial inserts of static data are also done in code using NHibernate. It makes for a very simple development experience.

No more managing huge SQL scripts :)


Juanma said...

Just a suggestion... instead of manually parsing connectionstring, you could use SqlConnectionStringBuilder, which also support other formats of connection strings.

Mike Hadlow said...

Juanma, that sounds interesting. Is SqlConnectionStringBuilder part of NHiberante?

Simon said...

I've been doing a similar thing with my current project. I started that way, but now live data is being entered by users, I can't drop and recreate the database. Instead, when changing the model I run SchemaUpdate with different parameters which adds any new tables or columns without deleting anything.

I've got a web page linked to this (only accessible when logged in as admin) which I hit after uploading new DLLs. Makes deploying updates much simpler.

Juanma said...

SqlConnectionStringBuilder is part of the framework:

SqlConnectionStringBuilder at MSDN

I've found it very useful for connection string manipulations, like changing the initial catalog (master <-> your_app_db).

Peter Weissbrod said...

In a staging production environment you are looking for a way to upgrade an existing database with schema updates.
.NET is still catching up to ruby when it comes to rake migrations. In the meantime, sql scripts of some sort are the best I can find