コード例 #1
0
ファイル: Shapes.cs プロジェクト: raelyard/Orchard.Disqus
        private static string GetUniqueIdentifier(ContentItem item)
        {
            string slug = null;
            if (item.Has<AutoroutePart>())
            {
                var route = item.Get<AutoroutePart>();
                slug = route.Path;
            }

            return string.Format("{0} {1}", item.Id, slug);
        }
コード例 #2
0
        private static RouteValueDictionary GetRouteValues(IContentItemDriver driver, ContentItem contentItem) {
            //TODO: (erikpo) Need to rearrange ContentItemDriver so reflection isn't needed here
            var driverType = driver.GetType();
            var method = driverType.GetMethod("GetDisplayRouteValues");

            if (method != null) {
                return (RouteValueDictionary)method.Invoke(driver, new object[] {contentItem.Get(driverType.BaseType.GetGenericArguments()[0])});
            }

            return null;
        }
コード例 #3
0
        public string GetUniqueIdentifier(ContentItem item)
        {
            string slug = null;
            if (item.Has<RoutePart>())
            { 
                var route = item.Get<RoutePart>();
                slug = route.Slug;
            }

            return string.Format("{0} {1}", item.Id, slug);
        }
コード例 #4
0
 /// <summary>
 /// Gets a content part by its type.
 /// </summary>
 /// <returns>The content part or <code>null</code> if it doesn't exist.</returns>
 public static TPart As <TPart>(this ContentItem contentItem) where TPart : ContentPart
 {
     return(contentItem.Get <TPart>(typeof(TPart).Name));
 }
コード例 #5
0
 private void SetupTagCloudLoader(ContentItem item) {
     var cloudPart = (TagCloudPart) item.Get(typeof (TagCloudPart));
     cloudPart._tagCounts.Loader(tags =>
     _tagCloudService.GetPopularTags(cloudPart.Buckets, cloudPart.Slug).ToList());
 }
コード例 #6
0
 private void SetupTagCloudLoader(ContentItem item)
 {
     var cloudPart = (LocalizedTagCloudPart)item.Get(typeof(LocalizedTagCloudPart));
     cloudPart._tags.Loader(() => _tagsService.GetLocalizedTags().ToList());
 }