fluent-nhibernate
fluent-nhibernate copied to clipboard
Unable to automap a simple collection of IUserTypes
Using an IHasManyConvention convention as follows, I can almost generate the correct mapping. However, I can't remove the one-to-many element.
instance.AsSet();
var tableName = Inflector.Inflector.Pluralize(instance.EntityType.Name + instance.Member.Name);
instance.Table(tableName);
instance.Key.Column(instance.EntityType.Name + "Id");
instance.Element.Column("RoomId");
instance.Element.Type<RoomUserType>();
The one-to-many element is added by this code:
https://github.com/jagregory/fluent-nhibernate/blob/master/src/FluentNHibernate/Automapping/Steps/CollectionStep.cs#L73
This is the closest I've been able to come to my desired mapping. I can't kill off the one-to-many with a convention.
<set name="Rooms" table="TestEntityRooms">
<key>
<column name="TestEntityId" />
</key>
<element type="JobService.Core.Enumerations.RoomUserType, JobService.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<column name="RoomId" />
</element>
<one-to-many class="JobService.Core.Enumerations.Room, JobService.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</set>
Can you please provide full example of your code? If that's not a public project, you can email me. By the way, which version of Fluent are you using?
And it would be great if you provide a reason why you're trying to remove one2many. What behaviour are you after?