NH work with implementation of IIdentifierType On Fri, Jun 11, 2010 at 4:12 PM, Trinition <[email protected]> wrote:
> In my domain, I'd really prefer to have strongly-typed IDs (simple > immutable wrappers around ints). This would allow me to have clear > method signatures and allow Intellisense to assist me more accurately: > > public void ResetFirmLockout(FirmId firmId); // Consider this strongly- > typed identity... > public void ResetFirmLockout(intfirmId); // Consider this weakly-typed > identity... > > It may sound trivial, but I've pulled it off half-way and it has been > quite nice to have it this way (I'm using a private int field "_id" > but exposing a readonly-property to the domain of type FirmId that is > constructed on the fly). > > The only problem is that I can't get NHibernate to recognize a > component as it's identiy. The "<id...>" takes a Type that must be an > NHibernate type like "Int32". I can't specify a user type such as > "FirmId". > > I've also considered <composite-id>, but it only works with > application-assigned identifiers, whereas I do want to rely upon DB- > generated identities. > > I considered a custom IIdentityGenerator, but as best I can tell, it > would still have to be an NHibernate type (e.g. "Int32"). > > Has anyone else ever accomplished this? > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- Fabio Maulo -- You received this message because you are subscribed to the Google Groups "nhusers" 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/nhusers?hl=en.
