I'm attempting to compile a base library that uses nhibernate for other developers to use across our organization, and would prefer not to force an primary key strategy on all projects. This library was not originally created by me, and I'm just attempting to add support for hilo to it. The library contains multiple entities that will be standard in any applications database which they can then extend/use.
We are using a custom IUserType and mapping it to either int, long, or guid based upon the compilation options, and also changing the IIdentifierGenerator. I've run into a couple of issues. The root issue seems to be the TableGenerator.cs that TableHiLoGenerator inherits from. Specifically it's forcing any custom IType to inherit from PrimitiveType. I can of course change our strategy to inherit from PrimitiveType, but then it also checks to see whether the custom IType is either Int16type or Int64Type, which I can't inherit from since they have internal constructors. I can send a patch for fixing this issue, but am unsure what the best approach would be. I can either remove the internal constuctors on each type, or just change the TableGenerator to use the PrimitiveTypes SqlType. (I think this second option has the least impact, though I also hate internals in general). Please let me know your thoughts and whether you're interested in a patch, thanks.
