簡體   English   中英

如何在流暢的nhibernate中映射“對象”類型屬性

[英]How can i map “object” type property in fluent nhibernate

我編寫了類及其映射,但是當我想運行我的項目時,拋出此錯誤:

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");
    }
}

您究竟期望將System.Object保留在那里嗎?

如果是通過序列化,則應將Serializable用作NH類型,並將varbinary(max)用於SQL。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM