Orchardcms 具有复杂类型的SchemaBuilder
我想存储复杂的内容部分记录,但无法在迁移文件中使用SchemaBuilder创建列 以下是我的课程:Orchardcms 具有复杂类型的SchemaBuilder,orchardcms,Orchardcms,我想存储复杂的内容部分记录,但无法在迁移文件中使用SchemaBuilder创建列 以下是我的课程: public enum BoxInheritance { Empty, Inherit, Enter } public class BoxSize { public string Width { get; set; } public string Height { get; set; } } public class BoxSpace { public str
public enum BoxInheritance
{
Empty, Inherit, Enter
}
public class BoxSize
{
public string Width { get; set; }
public string Height { get; set; }
}
public class BoxSpace
{
public string Left { get; set; }
public string Right { get; set; }
public string Top { get; set; }
public string Bottom { get; set; }
}
public class BoxPartRecord : ContentPartRecord
{
public virtual BoxSize Size { get; set; }
public virtual BoxSpace Space { get; set; }
public virtual Dictionary<string, BoxInheritance> Inheritances { get; set; }
public BoxPartRecord()
{
Size = new BoxSize();
Space = new BoxSpace();
Inheritances = new Dictionary<string, BoxInheritance>();
}
}
公共枚举继承
{
空、继承、输入
}
公营舱位
{
公共字符串宽度{get;set;}
公共字符串高度{get;set;}
}
公共类盒子空间
{
左公共字符串{get;set;}
公共字符串权限{get;set;}
公共字符串Top{get;set;}
公共字符串底部{get;set;}
}
公共类BoxPartRecord:ContentPartRecord
{
公共虚拟框大小{get;set;}
公共虚拟箱空间{get;set;}
公共虚拟字典继承{get;set;}
公共档案
{
大小=新的BoxSize();
空格=新的BoxSpace();
继承=新字典();
}
}
使用这样的内容部分记录可以吗?
如何为此内容部分记录创建一个表?我认为这行不通。我的建议是在记录类中使用简单类型,在内容部分本身中使用复杂类型(您可以在那里进行映射)
我想这行不通。我的建议是在记录类中使用简单类型,在内容部分本身中使用复杂类型(您可以在那里进行映射)
public class BoxPartRecord
{
public virtual int Width { get; set; }
public virtual int Height { get; set; }
...
}
public class BoxPart : ContentPart
{
public BoxSize Size { get { return new BoxSize {record.Width, record.Height} ...
}