csharp Umbraco包UI-O-Matic示例(https://our.umbraco.org/projects/developer-tools/ui-o-matic/)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp Umbraco包UI-O-Matic示例(https://our.umbraco.org/projects/developer-tools/ui-o-matic/)相关的知识,希望对你有一定的参考价值。
namespace OnePageImpactReport.Models
{
[UIOMaticAttribute("ImpactOrganisations", "icon-users", "icon-user")]
[TableName("ImpactOrganisations")]
[PrimaryKey("Id", autoIncrement = true)]
[ExplicitColumns]
public class ImpactOrganisation : IUIOMaticModel
{
[UIOMaticIgnoreField]
[Column("id")]
[PrimaryKeyColumn(AutoIncrement = true)]
public int Id { get; set; }
[Required]
[Column("OwnerMemberId")]
[UIOMaticField("Owner Member", "", View = "pickers.member")]
public int OwnerMemberId { get; set; }
[Column("OrganisationName")]
[Required]
public string Name { get; set; }
[Column("LogoUrl"), NullSetting(NullSetting = NullSettings.Null)]
public string LogoUrl { get; set; }
[Column("Summary"), NullSetting(NullSetting = NullSettings.Null)]
[AllowHtml]
[MaxLength(200)]
[UIOMaticField("Summary", "Appears on all reports", View = "textarea")]
public string Summary { get; set; }
[Column("Email"), NullSetting(NullSetting = NullSettings.Null)]
public string Email { get; set; }
[Column("Tel"), NullSetting(NullSetting = NullSettings.Null)]
public string Tel { get; set; }
[Column("Url"), NullSetting(NullSetting = NullSettings.Null)]
public string Url { get; set; }
[Column("Legal"), NullSetting(NullSetting = NullSettings.Null)]
[UIOMaticField("Legal", "Appears in report footer", View = "textarea")]
public string Legal { get; set; }
public IEnumerable<Exception> Validate()
{
var exs = new List<Exception>();
if (string.IsNullOrEmpty(Name))
exs.Add(new Exception("Name is required"));
if (OwnerMemberId == 0)
exs.Add(new Exception("Owner Member is required"));
return exs;
}
public override string ToString()
{
return Name + " (" + OwnerMemberId + ")";
}
}
}
以上是关于csharp Umbraco包UI-O-Matic示例(https://our.umbraco.org/projects/developer-tools/ui-o-matic/)的主要内容,如果未能解决你的问题,请参考以下文章
csharp 一个Umbraco启动课程
csharp 用于嘲弄的Umbraco测试容器
csharp Umbraco获得所有重复的媒体
csharp 一堆Umbraco Membership API片段
csharp 使用Umbraco Examine API搜索多个术语。
csharp Umbraco IPublishedContent的一些有用的扩展方法。