Represents the configured settings for the blog engine.
        /// <summary>
        /// Initializes a new instance of the <see cref="SyndicationGenerator"/> class using the supplied <see cref="BlogSettings"/> and collection of <see cref="Category"/> objects.
        /// </summary>
        /// <param name="settings">
        /// The <see cref="BlogSettings"/> to use when generating syndication results.
        /// </param>
        /// <param name="categories">
        /// A collection of <see cref="Category"/> objects used to categorize the web log content.
        /// </param>
        public SyndicationGenerator(BlogSettings settings, List<Category> categories)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            if (categories == null)
            {
                throw new ArgumentNullException("categories");
            }

            // ------------------------------------------------------------
            // Initialize class state
            // ------------------------------------------------------------
            this.Settings = settings;

            if (categories.Count <= 0)
            {
                return;
            }

            var values = new Category[categories.Count];
            categories.CopyTo(values);

            foreach (var category in values)
            {
                this.Categories.Add(category);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns the settings for the requested blog instance.
        /// </summary>
        public static BlogSettings GetInstanceSettings(Blog blog)
        {
            BlogSettings blogSettings;

            if (!blogSettingsSingleton.TryGetValue(blog.Id, out blogSettings))
            {
                lock (SyncRoot)
                {
                    if (!blogSettingsSingleton.TryGetValue(blog.Id, out blogSettings))
                    {
                        // settings will be loaded in constructor.
                        blogSettings = new BlogSettings();

                        blogSettingsSingleton[blog.Id] = blogSettings;
                    }
                }
            }

            return blogSettings;
        }