![](/img/trans.png)
[英]Fluent nhibernate: How do I map an entity with a property who's type is an interface?
[英]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.