/// <summary>
        /// Create.
        /// </summary>
        /// <param name="permissionsSetupProvider">
        /// The provider for a <see cref="PermissionsSetup"/> instance.
        /// </param>
        public AccessResolver(IPermissionsSetupProvider permissionsSetupProvider)
        {
            if (permissionsSetupProvider == null)
            {
                throw new ArgumentNullException(nameof(permissionsSetupProvider));
            }

            lazyAccessMapper = new Lazy <AccessMapper>(() => new AccessMapper(permissionsSetupProvider), true);

            rolesAccessRightsCache =
                new MRUCache <EquatableReadOnlyBag <string>, AccessRight>(
                    CombineAccessRightOfRoles,
                    RolesAccessRightsCacheSize);

            dispositionTypesAccessRightsCache =
                new MRUCache <EquatableReadOnlyBag <string>, AccessRight>(
                    CombineAccessRightOfDispositionTypes,
                    DispositionTypesAccessRightsCacheSize);
        }
        /// <summary>
        /// Create.
        /// </summary>
        /// <param name="configurationSectionName">The name of the configuration section in which the <see cref="Settings"/> are defined.</param>
        internal LogicSessionEnvironment(string configurationSectionName)
        {
            if (configurationSectionName == null)
            {
                throw new ArgumentNullException(nameof(configurationSectionName));
            }

            this.ConfigurationSectionName = configurationSectionName;

            this.Settings = LoadSettings(configurationSectionName);

            var permissionsSetupProvider = this.Settings.Resolve <IPermissionsSetupProvider>();

            this.AccessResolver = new AccessResolver <U>(permissionsSetupProvider);

            lazyLoggerRepository = new Lazy <Logging.LoggersRepository>(
                this.CreateLoggerRepository,
                true);

            lazyContentTypeIDsByMIME = new Lazy <IReadOnlyDictionary <string, int> >(
                this.LoadContentTypeIDsByMIME,
                true);

            lazyContentTypesByExtension = new Lazy <IReadOnlyDictionary <string, string> >(
                this.LoadContentTypesByExtension,
                true);

            storageProvidersCache = new MRUCache <string, Storage.IStorageProvider>(
                name => name != String.Empty ? this.Settings.Resolve <Storage.IStorageProvider>(name) : this.Settings.Resolve <Storage.IStorageProvider>(),
                StorageProvidersCacheSize);

            mailQueue = new AsyncWorkQueue <System.Net.Mail.MailMessage>(
                this,
                SendEmailAsync,
                $"{configurationSectionName}.{EmailQueueLoggerSuffixName}");

            channelPostLoggerName = $"{configurationSectionName}.{ChannelPostLoggerSuffixName}";
        }
Beispiel #3
0
 /// <summary>
 /// Create.
 /// </summary>
 /// <param name="cacheSize">Size of the cache of the settings per configuration section.</param>
 public SettingsFactory(int cacheSize = 2048)
 {
     settingsCache =
         new MRUCache <string, Settings>(Settings.Load <C>, cacheSize);
 }
 static ActionExecutionModelMetadataFactory()
 {
     metadataCache = new MRUCache <ActionExecutionModelMetadataKey, ActionExecutionModelMetadata>(CreateMetadata, 4096);
 }