configurationfluent-nhibernatedictionaryautomapping

How do I map a dictionary using Fluent NHibernate automapping?


I have an entity like so:

public class Land
{
    public virtual IDictionary<string, int> Damages { get; set; }
    // and other properties
}

Every time I try to use automapping with the following code:

var sessionFactory = Fluently.Configure()
    .Database(SQLiteConfiguration.Standard.InMemory)
    .Mappings(m => m.AutoMappings.Add(AutoMap.AssemblyOf<Land>))
    .BuildSessionFactory();

I get the following error:

{"The type or method has 2 generic parameter(s), but 1 generic argument(s) were
provided. A generic argument must be provided for each generic parameter."}

Can someone tell me what I'm doing wrong? Also, this is just a simple example. I have much more dictionaries than just this one.


Solution

  • It is impossible with NHibernate.