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


C# Models.ContentTypeDefinition类代码示例

本文整理汇总了C#中Orchard.ContentManagement.MetaData.Models.ContentTypeDefinition的典型用法代码示例。如果您正苦于以下问题:C# ContentTypeDefinition类的具体用法?C# ContentTypeDefinition怎么用?C# ContentTypeDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ContentTypeDefinition类属于Orchard.ContentManagement.MetaData.Models命名空间,在下文中一共展示了ContentTypeDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetLayout

        private string GetLayout(ContentTypeDefinition contentTypeDefinition, ICollection<Section> data) {
            //check field valid
            if (contentTypeDefinition.Parts.Any()) {
                var part = contentTypeDefinition.Parts.First(x => x.PartDefinition.Name == contentTypeDefinition.Name);
                var partFields = part.PartDefinition.Fields.ToList();
                var fields = data.SelectMany(x => x.Rows)
                    .SelectMany(x => x.Columns)
                    .Where(x => x.Field != null)
                    .Select(x => x.Field).ToList();
                if (partFields.Any(f => f.Settings.ContainsKey(AlwaysInLayoutKey)
                                        && bool.Parse(f.Settings[AlwaysInLayoutKey])
                                        && !fields.Select(x => x.FieldName).Contains(f.Name))) {
                    return string.Empty;
                }
                foreach (var field in fields) {
                    if (partFields.Any(x => x.Name == field.FieldName)) {
                        field.IsValid = true;
                    }
                    else if (contentTypeDefinition.Parts.Any(x => x.PartDefinition.Name == field.FieldName)) {
                        field.IsValid = true;
                    }
                }
            }

            ViewDataDictionary viewData = new ViewDataDictionary();
            viewData.Add("Layout", data);
            string layout = _templateViewService
                .RenderView("Coevery.FormDesigner", "FormTemplate", "FormDesignerLayout", viewData);
            return layout;
        }
开发者ID:wezmag,项目名称:Coevery,代码行数:30,代码来源:LayoutController.cs

示例2: EditTypeViewModel

 public EditTypeViewModel(ContentTypeDefinition contentTypeDefinition)
 {
     Name = contentTypeDefinition.Name;
     DisplayName = contentTypeDefinition.DisplayName;
     Settings = contentTypeDefinition.Settings;
     TypeDefinition = contentTypeDefinition;
 }
开发者ID:rodpl,项目名称:Orchard2,代码行数:7,代码来源:EditTypeViewModel.cs

示例3: GetTypeFields

        private IEnumerable<EditPartFieldViewModel> GetTypeFields(ContentTypeDefinition contentTypeDefinition) {
            var implicitTypePart = contentTypeDefinition.Parts.SingleOrDefault(p => string.Equals(p.PartDefinition.Name, Name, StringComparison.OrdinalIgnoreCase));

            return implicitTypePart == null
                ? Enumerable.Empty<EditPartFieldViewModel>()
                : implicitTypePart.PartDefinition.Fields.Select((f, i) => new EditPartFieldViewModel(i, f) { Part = new EditPartViewModel(implicitTypePart.PartDefinition) });
        }
开发者ID:SunRobin2015,项目名称:RobinWithOrchard,代码行数:7,代码来源:EditTypeViewModel.cs

示例4: Create

        public int Create()
        {
            try {

                SchemaBuilder.CreateTable("ProxyPartRecord", table => table
                    .ContentPartRecord()
                    .Column("ServiceUrl", DbType.String)
                );

                var proxy = new ContentTypeDefinition("Proxy", "Proxy");
                ContentDefinitionManager.StoreTypeDefinition(proxy);
                ContentDefinitionManager.AlterTypeDefinition("Proxy", cfg => cfg.Creatable()
                    .WithPart("ProxyPart")
                    .WithPart("CommonPart")
                    .WithPart("TitlePart")
                    .WithPart("IdentityPart")
                    .WithPart("ContentPermissionsPart", builder => builder
                        .WithSetting("ContentPermissionsPartSettings.View", "Administrator")
                        .WithSetting("ContentPermissionsPartSettings.Publish", "Administrator")
                        .WithSetting("ContentPermissionsPartSettings.Edit", "Administrator")
                        .WithSetting("ContentPermissionsPartSettings.Delete", "Administrator")
                        .WithSetting("ContentPermissionsPartSettings.DisplayedRoles", "Administrator,Authenticated")
                    )
                );

            } catch (Exception e) {
                var message = string.Format("Error creating Proxy module. {0}", e.Message);
                Logger.Warning(message);
                Notifier.Warning(T(message));
                return 0;
            }
            return 1;
        }
开发者ID:SmartFire,项目名称:Proxy,代码行数:33,代码来源:Migrations.cs

示例5: TypeEditor

        public override IEnumerable<TemplateViewModel> TypeEditor(ContentTypeDefinition definition) {
            var settings = definition.Settings.GetModel<ContentPermissionsTypeSettings>();
            var model = new SecurableContentItemsSettingsViewModel {
                SecurableContentItems = settings.SecurableContentItems,
            };

            yield return DefinitionTemplate(model);
        }
开发者ID:SunRobin2015,项目名称:RobinWithOrchard,代码行数:8,代码来源:SecurableContentItemsEditorEvents.cs

示例6: EditTypeViewModel

 public EditTypeViewModel(ContentTypeDefinition contentTypeDefinition) {
     Name = contentTypeDefinition.Name;
     DisplayName = contentTypeDefinition.DisplayName;
     Settings = contentTypeDefinition.Settings;
     Fields = GetTypeFields(contentTypeDefinition).ToList();
     Parts = GetTypeParts(contentTypeDefinition).ToList();
     _Definition = contentTypeDefinition;
 }
开发者ID:SunRobin2015,项目名称:RobinWithOrchard,代码行数:8,代码来源:EditTypeViewModel.cs

示例7: CreateDynamicPermission

 /// <summary>
 /// Generates a permission dynamically for a content type
 /// </summary>
 public static Permission CreateDynamicPermission(Permission template, ContentTypeDefinition typeDefinition) {
     return new Permission {
         Name = String.Format(template.Name, typeDefinition.Name),
         Description = String.Format(template.Description, typeDefinition.DisplayName),
         Category = typeDefinition.DisplayName,
         ImpliedBy = (template.ImpliedBy ?? new Permission[0]).Select(t => CreateDynamicPermission(t, typeDefinition))
     };
 }
开发者ID:RasterImage,项目名称:Orchard,代码行数:11,代码来源:DynamicPermissions.cs

示例8: Edit

 public override IDisplayResult Edit(ContentTypeDefinition contentTypeDefinition)
 {
     return Shape<ContentTypeViewModel>("ContentType_Edit", model =>
     {
         model.DisplayName = contentTypeDefinition.DisplayName;
         return Task.CompletedTask;
     }).Location("Content");
 }
开发者ID:rodpl,项目名称:Orchard2,代码行数:8,代码来源:DefaultContentTypeDisplayDriver.cs

示例9: CreateSubmitPermission

 /// <summary>
 /// Generates a permission dynamically for a content type
 /// </summary>
 public static Permission CreateSubmitPermission(ContentTypeDefinition typeDefinition) {
     return new Permission {
         Name = String.Format(SubmitForm.Name, typeDefinition.Name),
         Description = String.Format(SubmitForm.Description, typeDefinition.DisplayName),
         Category = "Custom Forms",
         ImpliedBy = new [] { SubmitForm }
     };
 }
开发者ID:anycall,项目名称:Orchard,代码行数:11,代码来源:Permissions.cs

示例10: BuildTypeEditorAsync

 public Task BuildTypeEditorAsync(ContentTypeDefinition model, BuildEditorContext context)
 {
     return _typeDisplayDrivers.InvokeAsync(async contentDisplay =>
     {
         var result = await contentDisplay.BuildEditorAsync(model, context);
         if (result != null)
             result.Apply(context);
     }, Logger);
 }
开发者ID:yanghl22,项目名称:Orchard2,代码行数:9,代码来源:ContentDefinitionDisplayCoordinator.cs

示例11: TypeEditor

        public override IEnumerable<TemplateViewModel> TypeEditor(ContentTypeDefinition definition)
        {
            var settings = definition.Settings.GetModel<DynamicTypeSettings>();
            var model = new DynamicTypeSettingsViewModel
            {
                IsDeployed = settings.IsDeployed
            };

            yield return DefinitionTemplate(model);
        }
开发者ID:jgtaveras,项目名称:Coevery,代码行数:10,代码来源:DynamicTypeEditorEvents.cs

示例12: Export

        public XElement Export(ContentTypeDefinition typeDefinition) {
            var typeElement = NewElement(typeDefinition.Name, typeDefinition.Settings);
            if (typeElement.Attribute("DisplayName") == null && typeDefinition.DisplayName != null) {
                typeElement.Add(new XAttribute("DisplayName", typeDefinition.DisplayName));
            }

            foreach(var typePart in typeDefinition.Parts) {
                typeElement.Add(NewElement(typePart.PartDefinition.Name, typePart.Settings));
            }
            return typeElement;
        }
开发者ID:juaqaai,项目名称:CompanyGroup,代码行数:11,代码来源:ContentDefinitionWriter.cs

示例13: ContentTypeDefinitionBuilder

 public ContentTypeDefinitionBuilder(ContentTypeDefinition existing) {
     if (existing == null) {
         _parts = new List<ContentTypePartDefinition>();
         _settings = new SettingsDictionary();
     }
     else {
         _name = existing.Name;
         _displayName = existing.DisplayName;
         _parts = existing.Parts.ToList();
         _settings = new SettingsDictionary(existing.Settings.ToDictionary(kv => kv.Key, kv => kv.Value));
     }
 }
开发者ID:sjbisch,项目名称:Orchard,代码行数:12,代码来源:ContentTypeDefinitionBuilder.cs

示例14: GivenIHaveAContainableContentType

        public void GivenIHaveAContainableContentType(string name) {
            var webApp = Binding<WebAppHosting>();
            webApp.Host.Execute(() => {
                using (var environment = MvcApplication.CreateStandaloneEnvironment("Default")) {
                    var cdm = environment.Resolve<IContentDefinitionManager>();

                    var contentTypeDefinition = new ContentTypeDefinition(name, name);
                    cdm.StoreTypeDefinition(contentTypeDefinition);
                    cdm.AlterTypeDefinition(name, cfg => cfg.WithPart("CommonPart").WithPart("BodyPart").WithPart("RoutePart").WithPart("ContainablePart").Creatable().Draftable());
                }
            });
        }
开发者ID:rupertwhitlock,项目名称:IncreasinglyAbsorbing,代码行数:12,代码来源:OrchardSiteFactory.cs

示例15: ContentTypeDefinitionModel

        public ContentTypeDefinitionModel(ContentTypeDefinition contentTypeDefinition) {
            Parts = new List<ContentPartDefinitionModel>();
            Settings = new Dictionary<string, string>(contentTypeDefinition.Settings);

            foreach (var partDefinitionModel in contentTypeDefinition.Parts.Select(partDefinition => new ContentPartDefinitionModel(partDefinition)))
            {
                Parts.Add(partDefinitionModel);
            }

            Name = contentTypeDefinition.Name;
            DisplayName = contentTypeDefinition.DisplayName;
        }
开发者ID:kamaelyoung,项目名称:Orchard.Api,代码行数:12,代码来源:ContentTypeDefinitionModel.cs


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