コード例 #1
0
        /// <summary>
        /// Maps an EF PageVersion record from the db into an OpenGraphData
        /// object.
        /// </summary>
        /// <param name="dbPageVersion">PageVersion record from the database.</param>
        public OpenGraphData Map(PageVersion dbPageVersion)
        {
            var result = new OpenGraphData()
            {
                Description = dbPageVersion.MetaDescription,
                Title       = dbPageVersion.OpenGraphTitle
            };

            if (result.Image != null)
            {
                result.Image = _imageAssetSummaryMapper.Map(dbPageVersion.OpenGraphImageAsset);
            }

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Maps an EF PageVersion record from the db into an OpenGraphData
        /// object.
        /// </summary>
        /// <param name="dbPageVersion">PageVersion record from the database, must include the OpenGraphImageAsset property.</param>
        public OpenGraphData Map(PageVersion dbPageVersion)
        {
            var result = new OpenGraphData()
            {
                Description = dbPageVersion.OpenGraphDescription,
                Title       = dbPageVersion.OpenGraphTitle
            };

            if (dbPageVersion.OpenGraphImageId.HasValue && dbPageVersion.OpenGraphImageAsset == null)
            {
                throw new Exception($"{nameof(PageVersion)}.{nameof(dbPageVersion.OpenGraphImageAsset)} must be included in the EF query if using {nameof(OpenGraphDataMapper)}. ");
            }

            if (dbPageVersion.OpenGraphImageAsset != null)
            {
                result.Image = _imageAssetRenderDetailsMapper.Map(dbPageVersion.OpenGraphImageAsset);
            }

            return(result);
        }
コード例 #3
0
 public PageRenderDetails()
 {
     OpenGraph = new OpenGraphData();
 }
コード例 #4
0
 /// <summary>
 /// A lighter weight page data projection designed for rendering to a site when the
 /// templates, region and block data is not required. This object is specific to a
 /// particular version which may not always be the latest (depending on the query).
 /// </summary>
 public PageRenderSummary()
 {
     OpenGraph = new OpenGraphData();
 }