So lets talk about the relevant Fluent Nhibernate features:
The first item of interest is the Schema() method. The schema function tells NHibernate to pull this entity from a specified database. In my case this database exists on the same SQL Server. So I didn't need to try it on another server. If you have knowledge of this working on another server leave a comment here.
The next item of interest is the Table() method. This is pretty straight forward Fluent NHibernate and specifies the legacy table to pull your data from.
The next interesting feature is SchemaAction.None(). When developing our applications I have an integration test that is used to build all our default schema. I DONT want these table to be generated in our schema, they are external. SchemaAction.None() tells NHibernate not to create this entity in the database.
So that's it. A simple combination of Fluent NHibernate features to access data from a legacy database properly.
Wednesday, June 30, 2010
Using Fluent NHibernate With Legacy Databases
link -> Using Fluent NHibernate With Legacy Databases
I didn't know about the Schema and SchemaAction commands. Schema may help with the warehouse