Esempio n. 1
0
        internal CmsSetup(CmsConfig config)
        {
            SiteName      = config.SiteName;
            IsDevelopment = config.IsDevelopment;

            CollectionsAndPages = ConfigProcessingHelper.ProcessCollections(config);

            if (config.CustomLoginScreenRegistration != null)
            {
                CustomLoginScreenRegistration = new CustomTypeRegistrationSetup(config.CustomLoginScreenRegistration);
            }
            if (config.CustomLoginStatusRegistration != null)
            {
                CustomLoginStatusRegistration = new CustomTypeRegistrationSetup(config.CustomLoginStatusRegistration);
            }

            MapCollections(CollectionsAndPages.SelectNotNull(x => x as CollectionSetup));

            void MapCollections(IEnumerable <CollectionSetup> collections)
            {
                foreach (var collection in collections.Where(col => !col.Recursive))
                {
                    if (!_collectionMap.TryAdd(collection.Alias, collection))
                    {
                        throw new InvalidOperationException($"Duplicate collection alias '{collection.Alias}' not allowed.");
                    }

                    if (collection.Collections.Any())
                    {
                        MapCollections(collection.Collections);
                    }
                }
            }
        }
Esempio n. 2
0
        internal PropertyFieldSetup(FieldConfig field) : base(field)
        {
            Property   = field.Property ?? throw new ArgumentNullException(nameof(field.Property));
            EditorType = field.EditorType;

            if (field.Relation != null)
            {
                Relation = ConfigProcessingHelper.ProcessRelation(field.Relation);
            }
        }
Esempio n. 3
0
 internal PaneSetup(PaneConfig pane)
 {
     CustomType             = pane.CustomType;
     IsVisible              = pane.IsVisible;
     Label                  = pane.Label;
     VariantType            = pane.VariantType;
     Buttons                = pane.Buttons.ToList(button => new ButtonSetup(button));
     Fields                 = pane.Fields.ToList(x => ConfigProcessingHelper.ProcessField(x));
     SubCollectionLists     = pane.SubCollectionLists.ToList(x => new SubCollectionListSetup(x));
     RelatedCollectionLists = pane.RelatedCollectionLists.ToList(x => new RelatedCollectionListSetup(x));
 }
Esempio n. 4
0
        internal CmsSetup(CmsConfig config)
        {
            SiteName            = config.SiteName;
            IsDevelopment       = config.IsDevelopment;
            AllowAnonymousUsage = config.AllowAnonymousUsage;
            SemaphoreMaxCount   = config.SemaphoreMaxCount;

            Collections = ConfigProcessingHelper.ProcessCollections(config);

            CustomDashboardSectionRegistrations = config.CustomDashboardSectionRegistrations.ToList(x => new CustomTypeRegistrationSetup(x));
            if (config.CustomLoginScreenRegistration != null)
            {
                CustomLoginScreenRegistration = new CustomTypeRegistrationSetup(config.CustomLoginScreenRegistration);
            }
            if (config.CustomLoginStatusRegistration != null)
            {
                CustomLoginStatusRegistration = new CustomTypeRegistrationSetup(config.CustomLoginStatusRegistration);
            }

            MapCollections(Collections);

            void MapCollections(IEnumerable <CollectionSetup> collections)
            {
                foreach (var collection in collections.Where(col => !col.Recursive))
                {
                    if (!_collectionMap.TryAdd(collection.Alias, collection))
                    {
                        throw new InvalidOperationException($"Duplicate collection alias '{collection.Alias}' not allowed.");
                    }

                    if (collection.Collections.Any())
                    {
                        MapCollections(collection.Collections);
                    }
                }
            }
        }