如何使用Fluent NHibernate自动映射来映射字典? [英] How do I map a dictionary using Fluent NHibernate automapping?

查看:195
本文介绍了如何使用Fluent NHibernate自动映射来映射字典?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的实体:

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();

我得到以下错误:

{"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.

推荐答案

这是不可能的NHibernate。

It is impossible with NHibernate.

这篇关于如何使用Fluent NHibernate自动映射来映射字典?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆