public LambdaServiceBuilder AddProxyService <TContract>() { _serviceContainer.AddTransient <Invoker <TContract> >(x => { var serializer = x.GetRequiredService <IProxySerializer>(); var instance = x.GetRequiredService <TContract>(); var invoker = new Invoker <TContract>(serializer, instance); return(invoker); }); _serviceMap.RegisterContract(typeof(TContract)); return(this); }
public LambdaTestDispatcher(TContract instance) : base(new JsonProxySerializer()) { _instance = instance; LambdaServiceBuilder serviceBuilder = new LambdaServiceBuilder() .ConfigureDependencies(x => { x.AddSingleton(typeof(TContract), instance); }) .AddProxyService <TContract>(); _serviceMap = new ServiceMap(); _serviceMap.RegisterContract <TContract>(); _lambdaService = serviceBuilder.Build(); }
public LambdaDispatcher(string functionName, string region, ImmutableCredentials credentials) : base(new JsonProxySerializer()) { if (string.IsNullOrWhiteSpace(functionName)) { throw new ArgumentException("Must include function name", nameof(functionName)); } if (string.IsNullOrWhiteSpace(region)) { throw new ArgumentException("Must include region", nameof(region)); } _functionName = functionName; _region = region; _credentials = credentials ?? throw new ArgumentNullException(nameof(credentials)); _serviceMap = new ServiceMap(); _serviceMap.RegisterContract <TContract>(); _lambdaClient = new HttpClient(); }