public CreateStandardRequestMiddleware( OperationDelegate next, IOperationFormatter formatter) { _next = next ?? throw new ArgumentNullException(nameof(next)); _formatter = formatter ?? throw new ArgumentNullException(nameof(formatter)); }
public static Subscription New( IOperation operation, IOperationFormatter operationFormatter, IResultParser parser) { return((Subscription)_genericNew .MakeGenericMethod(new[] { parser.ResultType }) .Invoke(null, new object[] { operation, operationFormatter, parser }) !); }
public Configuration( ValueSerializerCollection valueSerializers, ResultParserCollection resultParsers, IOperationFormatter operationFormatter, IReadOnlyCollection <Delegate> operationPipelines) { ValueSerializers = valueSerializers; ResultParsers = resultParsers; OperationFormatter = operationFormatter; OperationPipelines = operationPipelines; }
public Subscription( IOperation operation, IOperationFormatter operationFormatter, IResultParser resultParser) { Id = Guid.NewGuid().ToString("N"); Operation = operation ?? throw new ArgumentNullException(nameof(operation)); OperationFormatter = operationFormatter ?? throw new ArgumentNullException(nameof(operationFormatter)); ResultParser = resultParser ?? throw new ArgumentNullException(nameof(resultParser)); _channel = Channel.CreateBounded <IOperationResult <T> >(4); }
public HttpOperationExecutor( Func <HttpClient> clientFactory, OperationDelegate <IHttpOperationContext> executeOperation, IOperationFormatter operationFormatter, IResultParserCollection resultParserResolver) { _clientFactory = clientFactory ?? throw new ArgumentNullException(nameof(clientFactory)); _executeOperation = executeOperation ?? throw new ArgumentNullException(nameof(executeOperation)); _operationFormatter = operationFormatter ?? throw new ArgumentNullException(nameof(operationFormatter)); _resultParserResolver = resultParserResolver ?? throw new ArgumentNullException(nameof(resultParserResolver)); }
public SocketOperationStreamExecutor( Func <CancellationToken, Task <ISocketConnection> > connectionFactory, ISubscriptionManager subscriptionManager, IOperationFormatter operationFormatter, IResultParserCollection resultParserResolver) { _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory)); _subscriptionManager = subscriptionManager ?? throw new ArgumentNullException(nameof(subscriptionManager)); _operationFormatter = operationFormatter ?? throw new ArgumentNullException(nameof(operationFormatter)); _resultParserResolver = resultParserResolver ?? throw new ArgumentNullException(nameof(resultParserResolver)); }
private Configuration CreateConfiguration(string clientName) { ClientOptionsModifiers options = _optionsMonitor.Get(clientName); if (options.ResultParsers.Count == 0) { throw new InvalidOperationException( $"The specified client `{clientName}` has no result parsers configured."); } if (options.OperationFormatter is null) { throw new InvalidOperationException( $"The specified client `{clientName}` has no operations formatter configured."); } Dictionary <string, IValueSerializer> serializers = ValueSerializers.All.ToDictionary(t => t.Name); foreach (ConfigureValueSerializers configure in options.ValueSerializers) { configure(serializers); } var serializerCollection = new ValueSerializerCollection(serializers); var parsers = new Dictionary <Type, IResultParser>(); foreach (ConfigureResultParsers configure in options.ResultParsers) { configure(serializerCollection, parsers); } var parserCollection = new ResultParserCollection(parsers); IOperationFormatter formatter = options.OperationFormatter(serializerCollection); var pipelines = new List <Delegate>(); foreach (ConfigureOperationPipeline configure in options.OperationPipelines) { configure(pipelines); } return(new Configuration( serializerCollection, parserCollection, formatter, pipelines)); }
public HttpOperationContext( IOperation operation, IOperationFormatter operationFormatter, IOperationResultBuilder result, IResultParser resultParser, HttpClient client, CancellationToken requestAborted) { Operation = operation ?? throw new ArgumentNullException(nameof(operation)); OperationFormatter = operationFormatter ?? throw new ArgumentNullException(nameof(operationFormatter)); Result = result ?? throw new ArgumentNullException(nameof(result)); ResultParser = resultParser ?? throw new ArgumentNullException(nameof(resultParser)); Client = client ?? throw new ArgumentNullException(nameof(client)); RequestAborted = requestAborted; RequestWriter = new MessageWriter(); }
public HttpOperationExecutorFactory( string name, Func <string, HttpClient> clientFactory, OperationDelegate <IHttpOperationContext> executeOperation, IOperationFormatter operationFormatter, IResultParserCollection resultParserResolver) { if (clientFactory is null) { throw new ArgumentNullException(nameof(clientFactory)); } Name = name ?? throw new ArgumentNullException(nameof(name)); _clientFactory = () => clientFactory(name); _executeOperation = executeOperation ?? throw new ArgumentNullException(nameof(executeOperation)); _operationFormatter = operationFormatter ?? throw new ArgumentNullException(nameof(operationFormatter)); _resultParserResolver = resultParserResolver ?? throw new ArgumentNullException(nameof(resultParserResolver)); }
public SocketOperationStreamExecutorFactory( string name, Func <string, CancellationToken, Task <ISocketConnection> > connectionFactory, ISubscriptionManager subscriptionManager, IOperationFormatter operationFormatter, IResultParserCollection resultParserResolver) { if (connectionFactory is null) { throw new ArgumentNullException(nameof(connectionFactory)); } Name = name ?? throw new ArgumentNullException(nameof(name)); _connectionFactory = ct => connectionFactory(name, ct); _subscriptionManager = subscriptionManager ?? throw new ArgumentNullException(nameof(subscriptionManager)); _operationFormatter = operationFormatter ?? throw new ArgumentNullException(nameof(operationFormatter)); _resultParserResolver = resultParserResolver ?? throw new ArgumentNullException(nameof(resultParserResolver)); }
public SubscriptionManager(IOperationFormatter operationFormatter) { _operationFormatter = operationFormatter; }
public BasicCalculator(IOperationFormatter operationFormatter) { this._formatter = operationFormatter; }
public static Subscription <T> New <T>( IOperation <T> operation, IOperationFormatter operationFormatter, IResultParser parser) where T : class => new Subscription <T>(operation, operationFormatter, parser);
public void Setup() { operationFormatter = new OperationFormatter(); }
public void Setup() { accountManager = new AccountManager(); operationFormatter = new OperationFormatter(); account = new Account(accountManager, operationFormatter); }
public Account(IAccountManager accountManager, IOperationFormatter operationFormatter) { _accountManager = accountManager; _operationFormatter = operationFormatter; }
public BasicCalculator(IOperationFormatter formatter) { _formatter = formatter; }