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


C# IContentDefinitionManager.AlterTypeDefinition方法代码示例

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


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

示例1: MarkdownSiteSettingsPartHandler

        public MarkdownSiteSettingsPartHandler(IContentDefinitionManager contentDefinitionManager) {
            _contentDefinitionManager = contentDefinitionManager;
            Filters.Add(new ActivatingFilter<MarkdownSiteSettingsPart>("Site"));
            Filters.Add(new TemplateFilterForPart<MarkdownSiteSettingsPart>("MarkdownSiteSettings", "Parts/Markdown.MarkdownSiteSettings", "markdown"));
            OnInitializing<MarkdownSiteSettingsPart>((context, part) => {
                part.UseMarkdownForBlogs = false;
            });

            OnUpdated<MarkdownSiteSettingsPart>((context, part) => {
                var blogPost = _contentDefinitionManager.GetTypeDefinition("BlogPost");
                if (blogPost == null) {
                        return;
                }

                var bodyPart = blogPost.Parts.FirstOrDefault(x => x.PartDefinition.Name == "BodyPart");
                if (bodyPart == null) {
                    return;
                }

                _contentDefinitionManager.AlterTypeDefinition("BlogPost", build => build
                    .WithPart("BodyPart", cfg => cfg
                        .WithSetting("BodyTypePartSettings.Flavor", part.UseMarkdownForBlogs ? "markdown" : "html")
                    )
                );
            });

            T = NullLocalizer.Instance;
        }
开发者ID:jdages,项目名称:AndrewsHouse,代码行数:28,代码来源:MarkdownSiteSettingsPartHandler.cs

示例2: SetupRepoPageContentType

 public static void SetupRepoPageContentType(IContentDefinitionManager contentDefinitionManager, string pageContentTypeName)
 {
     contentDefinitionManager.AlterTypeDefinition(pageContentTypeName,
         cfg => cfg
             .WithPart("TitlePart")
             .WithPart("CommonPart")
             .WithPart("AutoroutePart", builder => builder
                 .WithSetting("AutorouteSettings.AllowCustomPattern", "false")
                 .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "true")
                 .WithSetting("AutorouteSettings.PatternDefinitions", "[{Name:'Title', Pattern: '{Content.Slug}', Description: 'my-page'}]")
                 .WithSetting("AutorouteSettings.DefaultPatternIndex", "0"))
             .WithPart(typeof(MarkdownPagePart).Name)
             .WithPart("BodyPart", builder => builder
                 .WithSetting("BodyTypePartSettings.Flavor", "markdown"))
         );
 }
开发者ID:Lombiq,项目名称:Orchard-External-Pages,代码行数:16,代码来源:BaseMigrations.cs


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