我有这将有一些块,这些块的一些属性必须从SQL查询的数据进行初始化,所以在控制器我有一些像这样的内容区域:
foreach (ObjectType item in MyList)
{
BlockData currentObject = new BlockData
{
BlockDataProperty1 = item.ItemProperty1,
BlockDataProperty2 = item.ItemProperty2
};
/*Dont know what to do here*/
}
Run Code Online (Sandbox Code Playgroud)
我需要什么,是一起工作currentObject作为一个块,并将其添加到我已经在另一个块定义的内容区域.我试过用
myContentArea.Add(currentObject)
Run Code Online (Sandbox Code Playgroud)
但它表示无法将对象添加到内容区域,因为它期望一种IContent类型.
如何将该对象转换为IContent?
episerver ×1