Beispiel #1
0
        public static TScopedStoreOptions GetScopedStoreConfiguration <TInstanceOptions, TStoreOptions, TScopedStoreOptions>(this IParsedOptions <TInstanceOptions, TStoreOptions, TScopedStoreOptions> parsedOptions, string storeName, bool throwIfNotFound = true)
            where TInstanceOptions : class, IProviderInstanceOptions
            where TStoreOptions : class, IStoreOptions
            where TScopedStoreOptions : class, TStoreOptions, IScopedStoreOptions
        {
            parsedOptions.ParsedScopedStores.TryGetValue(storeName, out var scopedStoreOptions);
            if (scopedStoreOptions != null)
            {
                return(scopedStoreOptions);
            }

            if (throwIfNotFound)
            {
                throw new Exceptions.StoreNotFoundException(storeName);
            }

            return(null);
        }
Beispiel #2
0
        public static TQueueOptions GetQueueConfiguration <TInstanceOptions, TQueueOptions>(this IParsedOptions <TInstanceOptions, TQueueOptions> parsedOptions, string queueName, bool throwIfNotFound = true)
            where TInstanceOptions : class, IProviderInstanceOptions
            where TQueueOptions : class, IQueueOptions
        {
            parsedOptions.ParsedQueueOptions.TryGetValue(queueName, out var queueOptions);
            if (queueOptions != null)
            {
                return(queueOptions);
            }

            if (throwIfNotFound)
            {
                throw new Exceptions.QueueNotFound(queueName);
            }

            return(null);
        }