public void AddPartToType(string partName, string typeName)
 {
     _contentDefinitionManager.AlterTypeDefinition(typeName, typeBuilder => typeBuilder.WithPart(partName));
     _contentDefinitionEventHandlers.ContentPartAttached(new ContentPartAttachedContext {
         ContentTypeName = typeName, ContentPartName = partName
     });
 }
예제 #2
0
        public int Create()
        {
            ContentDefinitionManager.AlterPartDefinition("UserRegistrationPolicyPart", part => part
                                                         .Attachable(true)
                                                         .WithDescription("When a content is in editing mode, it adds the ability to accept/deny a policy and save the choice.")
                                                         );

            ContentDefinitionManager.AlterTypeDefinition("User", content => content
                                                         .WithPart("UserRegistrationPolicyPart"));

            ContentDefinitionManager.AlterPartDefinition("FavoriteCulturePart", builder => builder
                                                         .Attachable(false));
            ContentDefinitionManager.AlterTypeDefinition("User", content => content
                                                         .WithPart("FavoriteCulturePart"));
            _contentDefinitionEventHandlers.ContentPartAttached(
                new ContentPartAttachedContext {
                ContentTypeName = "User", ContentPartName = "FavoriteCulturePart"
            });

            return(3);
        }
예제 #3
0
        /// <summary>
        /// This migration added when we implemented the front end settings for display/
        /// edit controlled by ProfilePart, that need things you want to show on front end to
        /// be in the actual definitions of ContentTypes.
        /// </summary>
        public int UpdateFrom31()
        {
            ContentDefinitionManager.AlterPartDefinition("FavoriteCulturePart", builder => builder
                                                         .Attachable(false));
            ContentDefinitionManager.AlterTypeDefinition("CommunicationContact", content => content
                                                         .WithPart("FavoriteCulturePart"));
            _contentDefinitionEventHandlers.ContentPartAttached(
                new ContentPartAttachedContext {
                ContentTypeName = "CommunicationContact", ContentPartName = "FavoriteCulturePart"
            });

            return(32);
        }