Ayende wrote about Setting Up Zero Friction Projects - Data Access, and mentioned the new SchemaUpdate feature in NHibernate.
The idea being that the ddl is automagically created from the nhibernate hbm.xml files, and executed against the delvelopers local database.
Something like:
- Developer A changes the Order.hbm.xml where he adds a new field Discount.
- In ApplicationStart the ddl alter script is generated and executed against Developer A's local database, the next time the developer starts the application.
- Developer eventually does a check-in of the Order.hbm.xml, along with the other changes.
- Developer B does a get latest.
- When he starts the application, ApplicationStart executes the change dll, and now Developer B's local database is up to speed.
At what cost? Well, almost zero :-)
I have created a sample C# VS2008 Solution, that can be downloaded here.
5 comments:
Would it be possible to post a Visual Studio 2005 solution? I can't open the solution with Visual Studio 2008 Express.
Thanks...
I have updated the solution so that it has a VS 2005 solution file too.
Note that this is a web project, so you need SP1 for VS 2005.
Look at the web.config to change the database NHibernate uses.
it doesn't track deletions to old fields, only additions so is not really usable in my opinion.
I'm using Fluent NH for mapping and NH as ORM in my C# application..
The problem is with schemaupdate class.. if I create an instance of
that.. using the configuration I got from my exposeconfiguration
function.. It doesnot update the schema.. I need some better
documentation on SchemaUpdate class.. or might be.. setting the
configuration to accomodate the new schema in an old database.. for
versioning purposes..
I have tried a lot of variations but no DDL command is reflected on
the actual database using SchemaUpdate :(
is this my problem:
http://code.google.com/p/fluent-nhibernate/issues/detail?id=55?
Thankx in advance.
Sushant Khurana
i using NHibernate with PostgresSQL
my database has many schema it is created automatic every month so each month a Schema Ex: myschema.Order, myschema0509.Order and so on. How can i create a query like this:
"Select ... from myschema.Order, myschema0509.Order" using HQL
Anyone help me
Post a Comment