示例#1
0
        public void SetupCustomFields()
        {
            var mgr       = new ContentInterfaceRepository();
            var extension = mgr.GetCustomFieldsTypeExtension(new Guid(CmsPage.ApiId));

            extension.InterfaceFields.Add(new ChoiceInterfaceField
            {
                PropertyName     = "DisplayInNav",
                PropertyTypeName = typeof(bool).FullName
            });

            mgr.Save(extension);
        }
示例#2
0
        public void SetupDynamicTypes()
        {
            var fullDynamicTypeId = Guid.NewGuid();

            var repositories = new RepositoryMetadataManager();

            repositories.Save(new RepositoryMetdata
            {
                CustomRepositoryName = "Article",
                IsDynamic            = true,
                ApiId = fullDynamicTypeId
            });

            var mgr  = new ContentInterfaceRepository();
            var ext1 = new ContentInterface
            {
                ContentTypeId = fullDynamicTypeId,
                InterfaceName = KnownTypeExtensionNames.CustomFields
            };
            var ext2 = new ContentInterface
            {
                ContentTypeId = fullDynamicTypeId,
                InterfaceName = "SomePluginInfo"
            };

            mgr.Save(ext1);
            mgr.Save(ext2);

            var extension = mgr.GetCustomFieldsTypeExtension(fullDynamicTypeId);

            extension.InterfaceFields.Add(new ChoiceInterfaceField
            {
                PropertyName     = "IsFeatured",
                PropertyTypeName = typeof(bool).FullName
            });

            mgr.Save(extension);

            var repo = RepositoryActivator.ActivateRepository <ISupportsCmsForms>(fullDynamicTypeId);

            repo.Save(new DynamicVersionedContent(fullDynamicTypeId));
            //var drafts = repo.FindContentVersions("", ContentEnvironment.Draft);
            //if (!drafts.Any())
            //    throw new Exception();
        }