Mapping enum with NH

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Mapping enum with NH

Post by Shalex » Tue 20 Aug 2013 08:16

Thank you for the test model you have sent to us.

This XML was constructed basing on the model settings you have made in Entity Developer:

Code: Select all

<hibernate-mapping default-cascade="save-update" assembly="PM4.Model" namespace="PM4.Model" ...
    <EnumType Name="OperationType" IsFlags="True" UnderlyingType="SByte" class="OperationType" ...
    <EnumType Name="AccessType" IsFlags="True" UnderlyingType="SByte" class="AccessType, PM4.Model" ...
This is a designed behaviour.
PeterM wrote:I've send a model which includes two enums, one with the Assembly defined and one without (where I am assuming the default should be used?!).
NHibernate runtime will take model's assembly and namespace names and construct the following types for your enums:
  • class="PM4.Model.OperationType, PM4.Model"
  • class="PM4.Model.AccessType, PM4.Model"
If you want (for some reason) the full types in XML as well, set the Assembly and Namespace properties of the enum in Entity Developer.

PeterM
Posts: 14
Joined: Tue 16 Jul 2013 12:53

Re: Mapping enum with NH

Post by PeterM » Tue 20 Aug 2013 11:17

Hi,

Thanks for the reply and the only reason I got across this issue is because of a runtime error I got when coupling Envers into the project, that seems to be parsing the XML in such a way that it doesn't understand what assembly it has to look in by default.

I'll just set the assembly with all the enums, no problem.

Post Reply