如何在流畅的nhibernate中映射“对象”类型属性

时间:2011-01-30 10:11:11

标签: nhibernate fluent-nhibernate mapping

我编写了我的类及其映射,但是当我想运行我的项目时,这个错误已经抛出:

property mapping has wrong number of columns: Azarakhsh.Domain.HumanResource.Personnel.Core.AdditionalValue.Value type: Object

我的类和映射代码在这里:

public partial class AdditionalValue : PersistentObject
{
    virtual public Object Value { get; set; }
}


public class AdditionalValueMap : ClassMap<AdditionalValue>
{
    public AdditionalValueMap()
    {
        Map(p => p.Value)
            .CustomSqlType("sql_variant");
    }
}

1 个答案:

答案 0 :(得分:2)

您希望如何在那里持久保存System.Object?

如果是通过序列化,则应使用Serializable作为NH类型,使用varbinary(max)作为SQL。

相关问题