mycroes
mycroes

Reputation: 675

Fluent NHibernate mapping of Dictionary<Entity, int>

In my domain I have a Transport which can access Endpoints at certain positions, as such I have the following:

public class Transport
{
    public IDictionary<Endpoint, int> AccessPointPosition { get; set; }
}

Now I'm trying to map the AccessPointPosition through a combination of HasMany and AsMap, but I haven't succeeded in finding anything that passes the Fluent NHibernate configuration.

Am I overlooking something? Is this impossible? Is there any documentation on this subject?

Upvotes: 1

Views: 2028

Answers (1)

Radim K&#246;hler
Radim K&#246;hler

Reputation: 123861

The mapping with fluent could be like this:

HasMany(x => x.AccessPointPosition)
   // these are most likely by convention
   // .Table("tbl_AccessPointPosition") 
   // .KeyColumn("Transport_id")
   // ...
   .AsEntityMap("Endpoint_id")
   .Element("integer_col", part => part.Type<int>());

Some other related questions:

Upvotes: 6

Related Questions