Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Below, we show how attributes are used to associate a content data class with its summary class:

    [SummaryType(typeof(ArticleSummary))]
    public class ArticleContent : PageContent, IRelatable, IHasCode
    {
        [Summary]
        public string Code { get; set; }
        [Summary]
        public string Title { get; set; }
        [Summary]
        public string Category { get; set; }
        [Summary, UIHint("Multiline")]
        public string Intro { get; set; }

        public Video Video { get; set; }

        public ArticleContent()
        {
            BaseContent.InitialiseProperties(this);
        }
    }

ArticleSummary looks like this:

    [Serializable]
    public class ArticleSummary : Summary
    {
        public string Code { get; set; }
        public string Category { get; set; }
        public string Intro { get; set; }
    }

Notice that the ArticleSummary contains all the fields marked with the SummaryAttribute in the full content class, except for Title, which exists in the base Summary class already.

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.