/// <summary>
 /// Initializes a new instance of the <see cref="CompositeContextProviderFactory"/> class.
 /// </summary>
 /// <param name="selectionFunction">
 /// The selection function.
 /// </param>
 /// <param name="factories">
 /// The factories to combine.
 /// </param>
 public CompositeContextProviderFactory(Func<IEnumerable<IContextProvider>, Type, IContextProvider> selectionFunction, params IContextProviderFactory[] factories)
 {
     selectionFunction.ThrowIfNull("selectionFunction");
     factories.ThrowIfNull("factories");
     this.selectionFunction = selectionFunction;
     this.factories = factories;
 }
        /// <summary>
        ///     Creates a new instance of the <see cref="ExpressionInstanceFactory" /> class.
        /// </summary>
        /// <exception cref="ArgumentNullException">factory can not be null.</exception>
        /// <param name="factory">The factory.</param>
        /// <param name="name">The name of the factory.</param>
        /// <param name="description">The description of the factory.</param>
        public ExpressionInstanceFactory( Func<IMemberInformation, Object> factory, String name = null, String description = null )
            : base(name, description)
        {
            factory.ThrowIfNull( nameof( factory ) );

            _factory = factory;
        }
 /// <summary>
 /// Create an index with the specified index settings
 /// </summary>
 public IIndicesResponse CreateIndex(string index, Func<CreateIndexDescriptor, CreateIndexDescriptor> createIndexSelector)
 {
     index.ThrowIfEmpty("index");
     createIndexSelector.ThrowIfNull("createIndexSelector");
     var d = createIndexSelector(new CreateIndexDescriptor());
     var settings = d._IndexSettings;
     return this.CreateIndex(index, settings);
 }
Example #4
0
		public UrlResolver(Func<IRouteCollection> routes, IHttpRuntime httpRuntime)
		{
			routes.ThrowIfNull("routes");
			httpRuntime.ThrowIfNull("httpRuntime");

			_routes = new Lazy<IRouteCollection>(routes);
			_httpRuntime = httpRuntime;
		}
Example #5
0
		public ModelMapper(Func<Type, bool> parameterTypeMatchDelegate, IEnumerable<IModelPropertyMapper> propertyMappers)
		{
			parameterTypeMatchDelegate.ThrowIfNull("parameterTypeMatchDelegate");
			propertyMappers.ThrowIfNull("propertyMappers");

			_parameterTypeMatchDelegate = parameterTypeMatchDelegate;
			_modelPropertyMappers = propertyMappers.ToArray();
		}
        protected TexturedWindowRenderer(Func<TextureContent, WindowTexture> getWindowTextureDelegate)
        {
            getWindowTextureDelegate.ThrowIfNull("getWindowTextureDelegate");

            _getWindowTextureDelegate = getWindowTextureDelegate;
            BackgroundColor = Color.White;
            BorderColor = Color.White;
        }
Example #7
0
 /// <inheritdoc />
 public IIndicesOperationResponse PutWarmer(string name, Func<PutWarmerDescriptor, PutWarmerDescriptor> selector)
 {
     selector.ThrowIfNull("selector");
     return this.Dispatch<PutWarmerDescriptor, PutWarmerRequestParameters, IndicesOperationResponse>(
         d => selector(d.Name(name).AllIndices()),
         (p, d) => this.RawDispatch.IndicesPutWarmerDispatch<IndicesOperationResponse>(p, d)
     );
 }
        /// <summary>
        ///     Initializes a new instance of the <see cref="ExpressionMemberSelectionRule" /> class.
        /// </summary>
        /// <exception cref="ArgumentNullException">predicate can not be null.</exception>
        /// <param name="predicate">The predicate used to determine if a member matches the rule.</param>
        /// <param name="selectionMode">The selection mode to apply.</param>
        /// <param name="name">The name of the rule.</param>
        /// <param name="description">The description of the rule.</param>
        public ExpressionMemberSelectionRule( Func<IMemberInformation, Boolean> predicate, MemberSelectionMode selectionMode, String name = null, String description = null )
            : base(name, description)
        {
            predicate.ThrowIfNull( nameof( predicate ) );

            _predicate = predicate;
            _selectionMode = selectionMode;
        }
Example #9
0
        public ConcreteTypeConverter(Type baseType, Func<dynamic, Hit<dynamic>, Type> concreteTypeSelector, IEnumerable<string> partialFields)
        {
            concreteTypeSelector.ThrowIfNull("concreteTypeSelector");

            this._baseType = baseType;
            this._concreteTypeSelector = concreteTypeSelector;
            this._partialFields = partialFields;
        }
		/// <inheritdoc />
		public IObservable<IRecoveryStatusResponse> RestoreObservable(TimeSpan interval, Func<RestoreDescriptor, RestoreDescriptor> restoreSelector = null)
		{
			restoreSelector.ThrowIfNull("restoreSelector");

			var restoreDescriptor = restoreSelector(new RestoreDescriptor());
			var observable = new RestoreObservable(this, restoreDescriptor);
			return observable;
		}
Example #11
0
 public Task<IIndicesOperationResponse> PutWarmerAsync(string name, Func<PutWarmerDescriptor, PutWarmerDescriptor> selector)
 {
     selector.ThrowIfNull("selector");
     return this.DispatchAsync<PutWarmerDescriptor, PutWarmerQueryString, IndicesOperationResponse, IIndicesOperationResponse>(
         d => selector(d.Name(name).AllIndices()),
         (p, d) => this.RawDispatch.IndicesPutWarmerDispatchAsync(p, d)
     );
 }
		/// <inheritdoc />
		public IObservable<ISnapshotStatusResponse> SnapshotObservable(TimeSpan interval, Func<SnapshotDescriptor, SnapshotDescriptor> snapshotSelector = null)
		{
			snapshotSelector.ThrowIfNull("snapshotSelector");

			var snapshotDescriptor = snapshotSelector(new SnapshotDescriptor());
			var observable = new SnapshotObservable(this, snapshotDescriptor);
			return observable;
		}
Example #13
0
        public void Map(Func<IContainer> container, Type type, MethodInfo method, Routing.Route route)
        {
            container.ThrowIfNull("container");
            type.ThrowIfNull("type");
            method.ThrowIfNull("method");
            route.ThrowIfNull("route");

            route.RespondWithNoContent();
        }
		public JsonModelMapper(Func<Type, bool> parameterTypeMatchDelegate, JsonSerializerSettings serializerSettings, DataConversionErrorHandling errorHandling = DataConversionErrorHandling.UseDefaultValue)
		{
			parameterTypeMatchDelegate.ThrowIfNull("parameterTypeMatchDelegate");
			serializerSettings.ThrowIfNull("serializerSettings");

			_parameterTypeMatchDelegate = parameterTypeMatchDelegate;
			_serializerSettings = serializerSettings;
			_errorHandling = errorHandling;
		}
Example #15
0
 public Task<IIndicesOperationResponse> PutTemplateAsync(string name, Func<PutTemplateDescriptor, PutTemplateDescriptor> putTemplateSelector)
 {
     putTemplateSelector.ThrowIfNull("putTemplateSelector");
     var descriptor = putTemplateSelector(new PutTemplateDescriptor(this._connectionSettings).Name(name));
     return this.DispatchAsync<PutTemplateDescriptor, PutTemplateQueryString, IndicesOperationResponse, IIndicesOperationResponse>(
         descriptor,
         (p, d) => this.RawDispatch.IndicesPutTemplateDispatchAsync(p, d._TemplateMapping)
     );
 }
		public SimilarityDescriptor CustomSimilarities(
			Func<FluentDictionary<string, SimilarityBase>, FluentDictionary<string, SimilarityBase>> similaritySelector)
		{
			similaritySelector.ThrowIfNull("similaritySelector");
			var similarities = new FluentDictionary<string, SimilarityBase>(this._SimilaritySettings.CustomSimilarities);
			var newSimilarities = similaritySelector(similarities);
			this._SimilaritySettings.CustomSimilarities = newSimilarities;
			return this;
		}
		/// <inheritdoc />
		public IIndicesOperationResponse PutTemplate(string name, Func<PutTemplateDescriptor, PutTemplateDescriptor> putTemplateSelector)
		{
			putTemplateSelector.ThrowIfNull("putTemplateSelector");
			var descriptor = putTemplateSelector(new PutTemplateDescriptor(_connectionSettings).Name(name));
			return this.Dispatch<IPutTemplateRequest, PutTemplateRequestParameters, IndicesOperationResponse>(
				descriptor,
				(p, d) => this.RawDispatch.IndicesPutTemplateDispatch<IndicesOperationResponse>(p, d.TemplateMapping)
			);
		}
Example #18
0
        /// <summary>
        ///     Returns a string which only contains the characters matching the given predicate.
        /// </summary>
        /// <exception cref="ArgumentNullException">The string can not be null.</exception>
        /// <exception cref="ArgumentNullException">The predicate can not be null.</exception>
        /// <param name="str">The input string.</param>
        /// <param name="predicate">The predicate.</param>
        /// <returns>Returns a string which only contains the characters matching the given predicate.</returns>
        public static String KeepWhere( this String str, Func<Char, Boolean> predicate )
        {
            str.ThrowIfNull( nameof( str ) );
            predicate.ThrowIfNull( nameof( predicate ) );

            return new String( str.ToCharArray()
                                  .Where( predicate )
                                  .ToArray() );
        }
 public Task<IMultiGetResponse> MultiGetAsync(Func<MultiGetDescriptor, MultiGetDescriptor> multiGetSelector)
 {
     multiGetSelector.ThrowIfNull("multiGetSelector");
     var descriptor = multiGetSelector(new MultiGetDescriptor(this._connectionSettings));
     return this.DispatchAsync<MultiGetDescriptor, MultiGetQueryString, MultiGetResponse, IMultiGetResponse>(
         descriptor,
         (p, d) => this.RawDispatch.MgetDispatchAsync(p, d),
         this.Serializer.DeserializeMultiGetResponse
     );
 }
Example #20
0
        public UrlResolver(Func<IRouteCollection> routes, IUrlResolverConfiguration configuration, IHttpRuntime httpRuntime)
        {
            routes.ThrowIfNull("routes");
            configuration.ThrowIfNull("configuration");
            httpRuntime.ThrowIfNull("httpRuntime");

            _routes = new Lazy<IRouteCollection>(routes);
            _configuration = configuration;
            _httpRuntime = httpRuntime;
        }
Example #21
0
		public ModelMapper(IContainer container, Func<Type, bool> parameterTypeMatchDelegate, IEnumerable<IModelPropertyMapper> propertyMappers)
		{
			container.ThrowIfNull("container");
			parameterTypeMatchDelegate.ThrowIfNull("parameterTypeMatchDelegate");
			propertyMappers.ThrowIfNull("propertyMappers");

			_container = container;
			_parameterTypeMatchDelegate = parameterTypeMatchDelegate;
			_modelPropertyMappers = propertyMappers.ToArray();
		}
Example #22
0
        public AnalysisDescriptor Analyzers(
			Func<FluentDictionary<string, AnalyzerBase>, FluentDictionary<string, AnalyzerBase>> analyzerSelector)
        {
            analyzerSelector.ThrowIfNull("analyzerSelector");
            var analyzers = new FluentDictionary<string, AnalyzerBase>(this._AnalysisSettings.Analyzers);
            var newAnalyzers = analyzerSelector(analyzers);
            this._AnalysisSettings.Analyzers = newAnalyzers;

            return this;
        }
Example #23
0
        public AnalysisDescriptor CharFilters(
			Func<FluentDictionary<string, CharFilterBase>, FluentDictionary<string, CharFilterBase>> charFiltersSelecter)
        {
            charFiltersSelecter.ThrowIfNull("charFiltersSelecter");
            var charFilters = new FluentDictionary<string, CharFilterBase>(this._AnalysisSettings.CharFilters);
            var newCharFilters = charFiltersSelecter(charFilters);
            this._AnalysisSettings.CharFilters = newCharFilters;

            return this;
        }
Example #24
0
 /// <inheritdoc />
 public Task<IMultiGetResponse> MultiGetAsync(Func<MultiGetDescriptor, MultiGetDescriptor> multiGetSelector)
 {
     multiGetSelector.ThrowIfNull("multiGetSelector");
     var descriptor = multiGetSelector(new MultiGetDescriptor(_connectionSettings));
     var converter = CreateCovariantMultiGetConverter(descriptor);
     return this.DispatchAsync<MultiGetDescriptor, MultiGetRequestParameters, MultiGetResponse, IMultiGetResponse>(
         descriptor,
         (p, d) => this.RawDispatch.MgetDispatchAsync<MultiGetResponse>(p.DeserializationState(converter), d)
     );
 }
Example #25
0
        public AnalysisDescriptor Tokenizers(
			Func<FluentDictionary<string, TokenizerBase>, FluentDictionary<string, TokenizerBase>> tokenizerSelector)
        {
            tokenizerSelector.ThrowIfNull("tokenizerSelector");
            var tokenizers = new FluentDictionary<string, TokenizerBase>(this._AnalysisSettings.Tokenizers);
            var newTokenizers = tokenizerSelector(tokenizers);
            this._AnalysisSettings.Tokenizers = newTokenizers;

            return this;
        }
 /// <inheritdoc />
 public Task<IMultiGetResponse> MultiGetAsync(Func<MultiGetDescriptor, MultiGetDescriptor> multiGetSelector)
 {
     multiGetSelector.ThrowIfNull("multiGetSelector");
     var descriptor = multiGetSelector(new MultiGetDescriptor(_connectionSettings));
     var converter = CreateCovariantMultiGetConverter(descriptor);
     return this.DispatchAsync<MultiGetDescriptor, MultiGetQueryString, MultiGetResponse, IMultiGetResponse>(
         descriptor,
         (p, d) => this.RawDispatch.MgetDispatchAsync<MultiGetResponse>(p, d, converter)
     );
 }
		/// <inheritdoc />
		public IMultiGetResponse MultiGet(Func<MultiGetDescriptor, MultiGetDescriptor> multiGetSelector)
		{
			multiGetSelector.ThrowIfNull("multiGetSelector");
			var descriptor = multiGetSelector(new MultiGetDescriptor());
			var converter = CreateCovariantMultiGetConverter(descriptor);
			var customCreator = new MultiGetConverter((r, s) => this.DeserializeMultiGetResponse(r, s, converter));
			return this.Dispatch<MultiGetDescriptor, MultiGetRequestParameters, MultiGetResponse>(
				descriptor,
				(p, d) => this.RawDispatch.MgetDispatch<MultiGetResponse>(p.DeserializationState(customCreator), d)
			);
		}
        public Task MapAsync(Func<IContainer> container, Type type, MethodInfo method, Routing.Route route)
        {
            container.ThrowIfNull("container");
            type.ThrowIfNull("type");
            method.ThrowIfNull("method");
            route.ThrowIfNull("route");

            route.RespondWithNoContent();

            return Task.Factory.Empty();
        }
Example #29
0
        /// <summary>
        /// Gets warmers, query will be returned as json string
        /// </summary>
        public IWarmerResponse GetWarmer(Func<GetWarmerDescriptor, GetWarmerDescriptor> selector)
        {
            selector.ThrowIfNull("selector");
            var descriptor = selector(new GetWarmerDescriptor(_connectionSettings));
            descriptor.ThrowIfNull("descriptor");
            var path = this.PathResolver.GetWarmerPath(descriptor);

            ConnectionStatus status = this.Connection.GetSync(path);
            var r = this.Deserialize<WarmerResponse>(status);
            return r;
        }
Example #30
0
        public ReactiveCommand(
			Action<object> execute,
			Func<object, bool> canExecute,
			params INotifyPropertyChanged[] canExecuteNotifiers)
        {
            _execute = execute.ThrowIfNull();
            _canExecute = canExecute.ThrowIfNull();
            _canExecuteNotifiers = canExecuteNotifiers;

            _canExecuteNotifiers.ForEach(x => x.SubscribeWeakly(this, (c, s, e) => c.NotifyCanExecuteChanged()));
        }