Is this achieved using Id(x => x.Id).SetGeneratorClass(string) ?

2009/4/6 Hudson Akridge <[email protected]>

> You can have a custom Generator type (versus the built in assigned and
> generated strategies), but your entity Id needs to map directly to a
> property on your class. That property type needs to map directly to a
> SqlColumnType (UniqueIdentifier, Int, NVarchar, etc.). There's not really a
> way that I'm aware of to have a custom user type for an identity column.
> Your options are going to be limited to the basics: Int32, Int64, Guid, and
> String (mapped to Int, BigInt, UniqueIdentifier, and NVarchar as appropriate
> by NHibernate).
> When you map an Id(x => x.Id), that maps directly to your Id property on
> your mapped object (your Item class). The type of your property is inferred
> from that expression, then given to the <id> hbm.xml element's "type"
> attribute. Those are the basics of Id mapping with NHibernate. Check out
> chapter 5.1.4 in the 
> NHibernateDocs.<http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/pdf/nhibernate_reference.pdf>
>
> I hope that helps answer your question.
>
>
> On Fri, Apr 3, 2009 at 11:40 AM, Damian Hickey <[email protected]> wrote:
>
>> Hi,
>>
>> I can't set a custom type for Id, any particular reason why this is the
>> case?
>>
>> Id like to write something like:
>>
>> public sealed class ItemMap : ClassMap<Item> {
>>         public ItemMap () {
>>             WithTable("Items");
>>             Id(x => x.Id).*CustomTypeIs*
>> (typeof(MyCustomUserType).GeneratedBy.Assigned();
>>             ....
>>         }
>> }
>>
>> I assume there is some fundamental reason behind this and I'm new to
>> nhibernate.. could anyone shed any light?
>>
>> Thanks,
>>
>> Damian
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to