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();
        }
Ejemplo n.º 2
0
        public Function()
        {
            //Split for readability
            LambdaServiceBuilder serviceBuilder = new LambdaServiceBuilder();

            //Configure any dependancies
            serviceBuilder = serviceBuilder
                             .ConfigureDependencies(x =>
            {
                x.AddSingleton <IAdditionService, AdditionService>();
                x.AddSingleton <ISubtractionService, SubtractionService>();
            });

            //Add the proxy service to wire up the contracts
            //Only services that have been added will be exposed
            serviceBuilder = serviceBuilder
                             .AddProxyService <IAdditionService>()
                             .AddProxyService <ISubtractionService>();

            _service = serviceBuilder.Build();
        }