public AspNetCoreServiceMethodBinder( ServiceMethodProviderContext <TService> context, IMarshallerFactory marshallerFactory) { _context = context; MarshallerFactory = marshallerFactory; }
private static byte[] SerializeInternal <T>(IMarshallerFactory factory, object value) { using (var context = new DefaultSerializationContext()) { factory.CreateMarshaller <T>().ContextualSerializer((T)value, context); return(context.GetContent()); } }
public SelfHostServiceMethodBinder( IMarshallerFactory marshallerFactory, Func <TService> serviceFactory, ServerServiceDefinition.Builder builder) { MarshallerFactory = marshallerFactory; _serviceFactory = serviceFactory; _builder = builder; }
public ErrorHandlerServerCallInterceptorFactory( IMarshallerFactory marshallerFactory, Func <IServiceProvider, IServerErrorHandler> errorHandlerFactory) { marshallerFactory.AssertNotNull(nameof(marshallerFactory)); _marshallerFactory = marshallerFactory; _errorHandlerFactory = errorHandlerFactory; }
public ServerCallErrorInterceptor( IServerErrorHandler errorHandler, IMarshallerFactory marshallerFactory) { errorHandler.AssertNotNull(nameof(errorHandler)); marshallerFactory.AssertNotNull(nameof(marshallerFactory)); _errorHandler = errorHandler; _marshallerFactory = marshallerFactory; }
public AspNetCoreServiceMethodBinder( ServiceMethodProviderContext <TService> context, IMarshallerFactory marshallerFactory, ServiceMethodFilterRegistration filterRegistration, bool requiresGrpcMarker) { _context = context; _filterRegistration = filterRegistration; _requiresGrpcMarker = requiresGrpcMarker; MarshallerFactory = marshallerFactory; }
public ClientCallErrorInterceptor( IClientErrorHandler errorHandler, IMarshallerFactory marshallerFactory, ILogger?logger) { errorHandler.AssertNotNull(nameof(errorHandler)); marshallerFactory.AssertNotNull(nameof(marshallerFactory)); ErrorHandler = errorHandler; MarshallerFactory = marshallerFactory; _logger = logger; }
public ServiceModelGrpcServerCallTest(IMarshallerFactory marshallerFactory, SomeObject payload) { var builder = new WebHostBuilder() .UseStartup(_ => new Startup(marshallerFactory)); _server = new TestServer(builder); _client = _server.CreateClient(); _request = new StubHttpRequest( _client, "/ITestService/PingPong", MessageSerializer.Create(marshallerFactory, new Message <SomeObject>(payload))); }
public ServiceModelGrpcClientCallTest(IMarshallerFactory marshallerFactory, SomeObject payload) { _payload = payload; _httpHandler = new StubHttpMessageHandler(marshallerFactory, new Message <SomeObject>(payload)); _channel = GrpcChannel.ForAddress("http://localhost", new GrpcChannelOptions { HttpHandler = _httpHandler }); var clientFactory = new ClientFactory(new ServiceModelGrpcClientOptions { MarshallerFactory = marshallerFactory }); _proxy = clientFactory.CreateClient <ITestService>(_channel); }
public static object DeserializeHeader(this IMarshallerFactory factory, Type valueType, byte[] valueContent) { valueType.AssertNotNull(nameof(valueType)); if (valueType == typeof(byte[])) { return(valueContent); } return(typeof(MarshallerFactoryExtensions) .StaticMethod(nameof(DeserializeInternal)) .MakeGenericMethod(valueType) .CreateDelegate <Func <IMarshallerFactory, byte[], object> >() .Invoke(factory, valueContent)); }
public static byte[] SerializeHeader(this IMarshallerFactory factory, object value) { factory.AssertNotNull(nameof(factory)); value.AssertNotNull(nameof(value)); if (value is byte[] buffer) { return(buffer); } return(typeof(MarshallerFactoryExtensions) .StaticMethod(nameof(SerializeInternal)) .MakeGenericMethod(value.GetType()) .CreateDelegate <Func <IMarshallerFactory, object, byte[]> >() .Invoke(factory, value)); }
public ServiceModelGrpcCombinedCallTest(IMarshallerFactory marshallerFactory, SomeObject payload) { _payload = payload; var builder = new WebHostBuilder().UseStartup(_ => new Startup(marshallerFactory)); _server = new TestServer(builder); _client = _server.CreateClient(); _channel = GrpcChannel.ForAddress("http://localhost", new GrpcChannelOptions { HttpClient = _client }); _clientFactory = new ClientFactory(new ServiceModelGrpcClientOptions { MarshallerFactory = marshallerFactory }); _proxy = _clientFactory.CreateClient <ITestService>(_channel); }
public static byte[] Create(IMarshallerFactory marshallerFactory, object data) => Create(MarshallerSerialize(marshallerFactory, data));
private static object DeserializeInternal <T>(IMarshallerFactory factory, byte[] content) { var result = factory.CreateMarshaller <T>().ContextualDeserializer(new DefaultDeserializationContext(content)); return(result !); }
public ContractMock(IMarshallerFactory marshallerFactory) { MarshallerFactory = marshallerFactory; }
public void Initialize(IMarshallerFactory marshallerFactory, Func <CallOptions>?defaultCallOptionsFactory) { MarshallerFactory = marshallerFactory; DefaultCallOptionsFactory = defaultCallOptionsFactory; }
internal abstract IUnaryCallTest CreateServiceModelGrpc(IMarshallerFactory marshallerFactory, SomeObject payload);
public StubHttpMessageHandler(IMarshallerFactory marshallerFactory, object response) { _responsePayload = MessageSerializer.Create(marshallerFactory, response); }
public static Metadata SerializeMethodInput <T1, T2>(IMarshallerFactory marshallerFactory, T1 value1, T2 value2) { return(CompatibilityTools.SerializeMethodInputHeader(marshallerFactory.CreateMarshaller <Message <T1, T2> >(), new Message <T1, T2>(value1, value2))); }
public Startup(IMarshallerFactory marshallerFactory) { _marshallerFactory = marshallerFactory; }
internal override IUnaryCallTest CreateServiceModelGrpc(IMarshallerFactory marshallerFactory, SomeObject payload) { return(new ServiceModelGrpcServerCallTest(marshallerFactory, payload)); }
public static T DeserializeMethodInput <T>(IMarshallerFactory marshallerFactory, Metadata?requestHeaders) { var message = CompatibilityTools.DeserializeMethodInputHeader(marshallerFactory.CreateMarshaller <Message <T> >(), requestHeaders); return(message.Value1); }