我正在使用NHibernate,我直接用屬性映射我的對象。我見過類似的問題,但大多數情況下人們使用映射文件......或者他們給出的答案不再存在的鏈接:)對於以下類,必須爲屬性Table添加哪些屬性一個IDictionary?我想這是像[地圖],但具有哪些屬性和/或元素?我在哪裏可以找到一些文件?我應該在我的類中使用哪種NHibernate.Mapping.Attribute來映射字典?
[Class(Table = "SpecificitySets", Name = "ZslSpecificityTable")]
public class SpecificityTable
{
[Id(0, TypeType = typeof(ulong), Name = "Id")]
[Generator(1, Class = "native")]
public uint Id
[Map(Name = "specificityMapping", Table = "SpecificityMapping")]
// and then ??
public virtual IDictionary<string, double> Table { get; private set; }
// ...
}
@Diego:是的,我不喜歡你的答案:)我參加這個項目,我不能不幸重新發明輪子。我想我寧願放棄字典... – PierrOz 2010-03-24 08:11:17