コード例 #1
0
ファイル: ContentStore.cs プロジェクト: TSalaam/karbon-cms
        /// <summary>
        /// Initializes a new instance of the <see cref="ContentStore"/> class.
        /// </summary>
        public ContentStore()
        {
            // Setup required components
            _fileStore = FileStoreManager.Default;
            _dataSerializer = DataSerializerManager.Default;
            _dataMapper = new DataMapper();

            // Setup file store event listener
            _fileStore.FileChanged += (sender, args) => _cacheDirty = true;
        }
コード例 #2
0
        /// <summary>
        /// Initializes this instance.
        /// </summary>
        /// <exception cref="System.Configuration.ConfigurationErrorsException">dataSerializers configuration section is not set correctly.</exception>
        /// <exception cref="System.Exception">_defaultProvider</exception>
        private static void Initialize()
        {
            // Parse config
            var config = (DataSerializersSection)ConfigurationManager.GetSection("karbon/dataSerializers");
            if (config == null)
                throw new ConfigurationErrorsException("dataSerializers configuration section is not set correctly.");

            // Create providers
            _providers = new DataSerializerCollection();

            ProvidersHelper.InstantiateProviders(config.Providers,
                _providers, typeof(DataSerializer));

            _providers.SetReadOnly();

            // Get default provider
            _defaultProvider = _providers[config.Default];

            if (_defaultProvider == null)
                throw new Exception("_defaultProvider");
        }