我正在尝试将一个小部件添加到Orchard站点,我创建了一个继承自ContentPartRecord的新内容部分。它构建得很好,但是当我去运行Orchard.exe或者当我浏览到网站时,我收到了这个错误:
Exception Details: NHibernate.MappingException: Association references unmapped class: System.string
这是我的班级:
using System.ComponentModel.DataAnnotations;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Records;
using System.Collections.Generic;
namespace Hjn.Models
{
public class PropertySearchRecord : ContentPartRecord
{
public virtual List<string> PropertyTypes { get; set; }
public virtual List<string> Locations { get; set; }
public virtual List<double> MinimumPrices { get; set; }
public virtual List<double> MaximumPrices { get; set; }
}
public class PropertySearchPart : ContentPart<PropertySearchRecord>
{
[Required]
public List<string> PropertyTypes
{
get { return Record.PropertyTypes; }
set { Record.PropertyTypes = value; }
}
[Required]
public List<string> Locations
{
get { return Record.Locations; }
set { Record.Locations = value; }
}
[Required]
public List<double> MinimumPrices
{
get { return Record.MinimumPrices; }
set { Record.MinimumPrices = value; }
}
[Required]
public List<double> MaximumPrices
{
get { return Record.MaximumPrices; }
set { Record.MaximumPrices = value; }
}
}
}
我很遗憾这个。 如果你愿意,我也可以发布堆栈跟踪。请告诉我。谢谢!
答案 0 :(得分:2)
是的,请勿使用List&lt;&gt;列的类型。相反,将它们作为n-n关系进行管理。有关于此的文档主题:http://docs.orchardproject.net/Documentation/Creating-1-n-and-n-n-relations