处理具有区分块的多个国家/地区(使用 episerver9.1 C#)
本文关键字:地区 使用 episerver9 国家 处理 | 更新日期: 2023-09-27 18:37:11
public class EpiBlock : SiteBlockData
{
[Display(Name = "SomeCommonData", GroupName = Global.GroupNames.Settings.General)]
[EditorDescriptor(EditorDescriptorType = typeof(RolesEditorDescriptor))]
public virtual string SomeCommonData { get; set; }
}
public class Controller : BlockControllerBase<EpiBlock>
{
private readonly IVmBuilder _vmBuilder;
public Controller(IVmBuilder vmBuilder)
{
_vmBuilder = vmBuilder;
}
public ActionResult Index(EpiBlock epiBlock, VmContext context)
{
Vm<EpiBlock> vm = _vmBuilder.CreateVm(epiBlock, context);
return PartialView(vm.ViewName, vm);
}
}
如何处理 episerver、注册和此控制器中的扩展 EpiBlockHungary
是否可以使用此块所在的同一控制器和页面(对于 EpiBlock 和 EpiBlockHungary)?
public class EpiBlockHungary : EpiBlock
{
[Display(Name = "SomeHungarianData", GroupName = Global.GroupNames.Settings.General)]
[EditorDescriptor(EditorDescriptorType = typeof(RolesEditorDescriptor))]
public virtual string SomeHungarianData { get; set; }
}
您可以使用 TemplateDescriptor 属性修饰控制器,并将其继承属性设置为 true:
[TemplateDescriptor(Inherited=true)]
public class Controller : BlockControllerBase<EpiBlock>
{
}