2
votes

I'm attempting to create an IDictionary on an object using another class as the key.

' Dictionary Mapping on Tool
    HasMany(Function(x) x.Roles).KeyColumn("ToolRole_ID").AsEntityMap("RoleType_ID").Inverse.Cascade.AllDeleteOrphan().Table("ToolRoles")

' RoleType Mapping
Public Sub New()
    Id(Function(x) x.ID).GeneratedBy.GuidComb().Column("ToolRole_ID")
    References(Function(x) x.Tool).Not.Nullable.Column("Tool_ID")
    References(Function(x) x.RoleType).Not.Nullable.Column("RoleType_ID")
    References(Function(x) x.User).Not.Nullable.Column("User_ID")
    Map(Function(x) x.LastModified).Not.Nullable()
    Table("ToolRoles")
End Sub

I no longer get any mapping errors thanks to this post: How to map this Dictionary with the newest fluentNHibernate version? , but my collection is not being populated even though I know it has child objects.

Any suggestions?

1

1 Answers

1
votes

because RoleType is a Property of ToolRole you could try the standard Map syntax.

HasMany(Function(x) x.Roles)
    .KeyColumn("ToolRole_ID")
    .AsMap(Function(x) x.RoleType)
    .Inverse()
    .Cascade.AllDeleteOrphan();