another new comer question

Original Post YankeeImperialistDog's Avatar

YankeeImperialistDog

24 Feb, 2010 09:26 PM via web

given i have a this

    <id name="Id" column="PersonID" type="Guid">
        <generator class="assigned"></generator>
    </id>

in my Person.hbm.xml

how is this represented in fluent?
I have this
Id(x => x.Id); which does not work. I'll take a good guess that is because Id is not a field in the Person table...

thanks

KES

  1. 2 Posted by David R. Longnecker on 24 Feb, 2010 10:05 PM

    David R. Longnecker's Avatar

    Id and Map both have an overload that allows you to specify the column names.

    Id(x => x.Id, "PersonID");

    For specifying the GeneratedBy, you can continue the chain:

    Id(x => x.Id, "PersonID").GeneratedBy.Assigned();

    If your Type in your class is a Guid, it should pass that along with the map automatically.

    More information on the wiki: http://wiki.fluentnhibernate.org/Fluent_mapping#Id

  2. 3 Posted by YankeeImperialistDog on 24 Feb, 2010 10:15 PM

    YankeeImperialistDog's Avatar

    That's what's cool about new comer questions. In general they are easy, the answer intuitive, and the questioner (me), is left with a "Oh, yeah, of course" feeling.

    Thanks!
    very appreciated.
    KES

Comments are currently closed for this discussion. You can start a new one.

Recent Discussions

05 Jul, 2010 10:29 PM
05 Jul, 2010 12:45 PM
05 Jul, 2010 12:42 PM
05 Jul, 2010 12:17 PM
05 Jul, 2010 12:12 PM

 

03 Jul, 2010 12:26 AM
02 Jul, 2010 02:17 PM
02 Jul, 2010 08:18 AM
02 Jul, 2010 12:20 AM
01 Jul, 2010 10:14 PM