Mapping Dictionary<int,Driver>
Hey all,
I've really been trying my best to map this particular type of collection but I just can't seem to crack it. I've tried StackOverflow, the newsgroups and this site but none of the code examples I have tried have worked yet :(
Here is the property I am trying to map:
public virtual IDictionary<int, Driver> StratumSpecificDrivers
{
get;
set;
}
Here is the mapping override I am using:
public void Override(FluentNHibernate.Automapping.AutoMapping<Module> mapping)
{
mapping.HasManyToMany(x => x.StratumSpecificDrivers)
.AsMap<int>(index => index.Column("Stratum").Type<int>(), element => element.Column("DriverId").Type<Driver>())
.Table("ModuleDriverOverrides")
.Cascade.All();
}
It might be worthwhile to note that there is also a property in this class that is of the same type but not in a dictionary:
public virtual Driver DefaultDriver
{
get;
set;
}
Any help is appreciated!
2 Posted by Jeffrey Cameron on 24 Apr, 2010 01:24 PM
I did some more digging and discovered I am getting an NRE around line 59 of ManyToManyPart.cs