当前位置: 首页>>代码示例>>C#>>正文


C# IPublishedContent.GetPropertyAsListingType方法代码示例

本文整理汇总了C#中IPublishedContent.GetPropertyAsListingType方法的典型用法代码示例。如果您正苦于以下问题:C# IPublishedContent.GetPropertyAsListingType方法的具体用法?C# IPublishedContent.GetPropertyAsListingType怎么用?C# IPublishedContent.GetPropertyAsListingType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPublishedContent的用法示例。


在下文中一共展示了IPublishedContent.GetPropertyAsListingType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetListing

        /// <summary>
        /// get listing
        /// </summary>
        /// <param name="content"></param>
        /// <param name="optimized">if set performs less DB interactions to increase speed.</param>
        /// <param name="projectKarma"></param>
        /// <returns></returns>
        public IListingItem GetListing(IPublishedContent content, bool optimized = false, int projectKarma = -1)
        {
            if (content != null)
            {
                var listingItem = new ListingItem.ListingItem(
                    p => GetProjectDownloadCount(p),
                    p => projectKarma < 0 ? GetProjectKarma(p) : projectKarma
                    );

                listingItem.Id = content.Id;
                listingItem.NiceUrl = library.NiceUrl(listingItem.Id);
                listingItem.Name = content.Name;
                listingItem.Description = content.GetPropertyValue<string>("description", "");
                listingItem.CurrentVersion = content.GetPropertyValue<string>("version", "");
                listingItem.CurrentReleaseFile = content.GetPropertyValue<string>("file", "");
                listingItem.DefaultScreenshot = content.GetPropertyValue<string>("defaultScreenshotPath", "");
                listingItem.DevelopmentStatus = content.GetPropertyValue<string>("status", "");
                listingItem.ListingType = content.GetPropertyAsListingType("listingType");
                listingItem.GACode = content.GetPropertyValue<string>("gaCode", "");
                listingItem.CategoryId = content.GetPropertyValue<int>("category");
                listingItem.Stable = content.GetPropertyValue<bool>("stable");
                listingItem.Live = content.GetPropertyValue<bool>("projectLive");
                listingItem.LicenseName = content.GetPropertyValue<string>("licenseName", "");
                listingItem.LicenseUrl = content.GetPropertyValue<string>("licenseUrl", "");
                listingItem.ProjectUrl = content.GetPropertyValue<string>("websiteUrl", "");
                listingItem.SupportUrl = content.GetPropertyValue<string>("supportUrl", "");
                listingItem.SourceCodeUrl = content.GetPropertyValue<string>("sourceUrl", "");
                listingItem.DemonstrationUrl = content.GetPropertyValue<string>("demoUrl", "");
                listingItem.OpenForCollab = content.GetPropertyValue<bool>("openForCollab", false);
                listingItem.NotAPackage = content.GetPropertyValue<bool>("notAPackage", false);
                listingItem.ProjectGuid = new Guid(content.GetPropertyValue<string>("packageGuid"));
                listingItem.Approved = content.GetPropertyValue<bool>("approved", false);
                listingItem.UmbracoVerionsSupported = content.GetPropertyValue<string>("compatibleVersions", "").Split(';');
                listingItem.NETVersionsSupported = (content.GetPropertyValue<string>("dotNetVersion", "") != null) ? content.GetPropertyValue<string>("dotNetVersion", "").Split(';') : "".Split(';');
                listingItem.TrustLevelSupported = content.GetPropertyAsTrustLevel("trustLevelSupported");
                listingItem.TermsAgreementDate = content.GetPropertyValue<DateTime>("termsAgreementDate");
                listingItem.CreateDate = content.CreateDate;
                listingItem.VendorId = content.GetPropertyValue<int>("owner");
                listingItem.Logo = content.GetPropertyValue<string>("logo", "");
                listingItem.LicenseKey = content.GetPropertyValue<string>("licenseKey", "");

                //this section was created to speed up loading operations and cut down on the number of database interactions
                if (optimized == false)
                {
                    listingItem.DocumentationFile = GetMediaForProjectByType(content.Id, FileType.docs);
                    listingItem.ScreenShots = GetMediaForProjectByType(content.Id, FileType.screenshot);
                    listingItem.PackageFile = GetMediaForProjectByType(content.Id, FileType.package);
                    listingItem.HotFixes = GetMediaForProjectByType(content.Id, FileType.hotfix);
                    listingItem.SourceFile = GetMediaForProjectByType(content.Id, FileType.source);
                }

                return listingItem;
            }
            throw new NullReferenceException("Content is Null");
        }
开发者ID:ClaytonWang,项目名称:OurUmbraco,代码行数:62,代码来源:NodeListingProvider.cs


注:本文中的IPublishedContent.GetPropertyAsListingType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。