I have a tree mapping in my IUser derived User. The hbm is an embedded
resource. My domain has Users with DirectReports (ISet of User) and an
Approver (also a User). I use convenience methods for setting and a
backing field for each of the properties.
My issue is that I notice that the ExportSchema output of the XML for
User is always the same despite any change to the XML that I make --
it always seems to change my many-to-many mapping. I get a UserToUser
table for mapping my DirectReports and Approver.
Here what I my User.hbm.xml looks like:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-
lazy="true" assembly="MyProject.Core" namespace="MyProject.Core">
<class name="MyProject.Core.User, MyProject.Core" table="Users"
xmlns="urn:nhibernate-mapping-2.2">
<id name="Id">
<generator class="identity" />
</id>
<property name="Username" type="System.String, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<column name="Username" length="255" not-null="true"
unique="true" />
</property>
<!-- ...abbreviated properties... -->
<set inverse="true" name="DirectReports" table="UsersToApprovers">
<key>
<column name="ApproverId" />
</key>
<many-to-many class="MyProject.Core.User, MyProject.Core,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<column name="UserId" />
</many-to-many>
</set>
<many-to-one class="MyProject.Core.User, MyProject.Core,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
name="Approver">
<column name="ApproverId" />
</many-to-one>
</class>
</hibernate-mapping>
Here's what I see if I Export the XML on a build:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-
access="property" auto-import="true" default-cascade="none" default-
lazy="true">
<class xmlns="urn:nhibernate-mapping-2.2" name="MyProject.Core.User,
MyProject.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
table="Users">
<id name="Id" type="System.Int32, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089" unsaved-value="0">
<column name="UserId" />
<generator class="identity" />
</id>
<!-- ...abbreviated properties...-->
<set name="DirectReports" table="UserToUser">
<key>
<column name="User_Id" />
</key>
<many-to-many class="MyProject.Core.User, MyProject.Core,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<column name="User_id" />
</many-to-many>
</set>
<many-to-one class="MyProject.Core.User, MyProject.Core,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
name="Approver">
<column name="ApproverId" />
</many-to-one>
</class>
</hibernate-mapping>
Why is Rhino overriding my User mapping? Is there a way to prevent
that?
--
You received this message because you are subscribed to the Google Groups
"Rhino Tools Dev" 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/rhino-tools-dev?hl=en.