CodeSmith Community
Your Code. Your Way. Faster!

NHibernate Class-to-mappings template?

Latest post 04-23-2008 3:44 PM by mathmax. 3 replies.
  • 10-14-2007 8:01 AM

    NHibernate Class-to-mappings template?

    I have seen several NHibernate templates here and elsewhere that will generate classes and mappings from a database. But I'm looking for the reverse. I develop my business objects first, so I'm looking for a template that will use a business model to generate mapping files and a database script.

    Is there a template, either here or elsewhere, that will do that? Thanks in advance for your help.

    Filed under:
    • Post Points: 35
  • 11-12-2007 11:55 AM In reply to

    • evolved
    • Top 50 Contributor
    • Joined on 12-27-2004
    • South River, NJ
    • Posts 96
    • Points 1,840

    Re: NHibernate Class-to-mappings template?

     Although there may possibly be one using reflection (assuming you didnt create a schema definition), you're really walking into murky water if you go this route, please let me explain - although the spirit of what you are doing is correct ie: identify your problem domain, and analize your data requirements first - you need to realize that how the data actully gets stored and accessed can't be determined from your class structure alone.  a table containing contact information, how long should FirstName be allocated for? should it only allow unique values? etc.

    http://www.jheidt.com
    ------------------------------
    Member of the .NetTiers team
    http://www.nettiers.com
    ------------------------------

    • Post Points: 35
  • 02-11-2008 12:41 PM In reply to

    Re: NHibernate Class-to-mappings template?

    its possible to generate hbm.xml from the code .. its possible and its helpful ...

    yes .. right ... not all the information is available because of the database table and column names ... but it would be good for me to have all my hbms generated with empty "" for the not available schema data ...

    is there a template for this ?

    • Post Points: 35
  • 04-23-2008 3:44 PM In reply to

    • mathmax
    • Not Ranked
    • Joined on 04-23-2008
    • Posts 1
    • Points 5

    Re: NHibernate Class-to-mappings template?

    I'm also very interrested by a such template. I also first writte my business objects and then the mapping file. Did you find a good one ?

     

    Regards,

     

    mathmax 

    • Post Points: 5
Page 1 of 1 (4 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems