I am using NHibernate in two projects which both have over 700 tables. I'm 
not saying it's the best (or even a good) approach, but I can tell you what 
we did. For us it wasn't enough to just map the tables. Our databases are 
in Dutch, and because we want to internationalize, we had the added 
requirement that we needed to map the Dutch names to proper English C# 
names. What I did:

   - I defined a high level abstraction of all the constructs our databases 
   use (the data types, foreign keys, whether a field can be signed or 
   mandatory, etc);


   - I wrote a tool which imported the current database scheme and allowed 
   the user to provide English names for all tables and fields and add missing 
   information like missing foreign keys, the ability to force a field to be 
   not nullable, etc;


   - From the result of this information, I generate the ORM classes and 
   the .hbm.xml file. (I started out physically generating the hbm file, but a 
   while back I switched to generating the hbm file in memory on startup.)


This is working out quite well for us so far. One of the added benefits for 
us is that we can use the abstracted scheme for other purposes. E.g., I 
wrote a database scheme synchronization tool based on the abstracted 
scheme. Now, we don't ship SQL migration scripts anymore. Instead, the 
application just loads the current database scheme and generates the SQL 
DDL scripts on the fly.

This all is a bit of work. It took me about a month to get all of this done 
(except for the DDL migration, which took a few weeks extra). But, now we 
have a very nice scheme and the ability to keep the physical database in 
sync with the scheme very easily.

On Wednesday, June 19, 2013 7:06:08 AM UTC+3, Surya Pratap wrote:
>
> check out 
>
> http://notherdev.blogspot.in/2012/02/nhibernates-mapping-by-code-summary.html 
> try to make a convention based mapper 
>
> On 19-06-2013 03:13, Jorge Potosme wrote: 
> > I have a database with about 800 tables, how can i use nhibernate to 
> > map that amount of tables? 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "nhusers" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to [email protected] <javascript:>. 
> > To post to this group, send email to [email protected]<javascript:>. 
>
> > Visit this group at http://groups.google.com/group/nhusers. 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to