GeneratorBuilder.Identity() unnecessarily restricting to integral types #230

Trinition opened this Issue Jun 19, 2013 · 0 comments


None yet
1 participant

GeneratorBuilder.Indentity() internalls calls EnsureIntegralIdenityType() to enforce that the identifier's type be integral. However, NHibernate itself doesn't have that restriction.

In my case, I'm using a custom NHibernate IUserType for my identifier:

        Id(x => x.Id)

Fluent NHibernate throws the exception from EnsureIntegralIdenityType(). However, if I cheat and work-around Fluent NHibernate's restriction, everything works just fine:

        Id(x => x.Id)

In my case, my custom type is, in fact, convertible to an int, although I'm not sure that NHibernate itself would care if I instead were convertible to a GUID, or other supported type.

I'm not sure I understand the spirit of why Fluent NHibernate goes this far in trying to enforce restrictions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment