예제 #1
0
        public static IServiceCollection AddCoreGateway(this IServiceCollection services, IConfiguration configuration)
        {
            ContextFactory.RegisterObject(new CoreContext(services, configuration));


            var mapper = new AcubecMapper(new CoreMapper());

            services.AddSingleton(typeof(IMapper), mapper);
            services.AddUtilities();

            return(services);
        }
예제 #2
0
        public static IServiceCollection AddSecurityLayer(this IServiceCollection services, IConfiguration configuration)
        {
            ContextFactory.RegisterObject(new SecurityContext(services, configuration));
            var connection = MongoDbConnection.FromConnectionString(configuration["ConnectionString"]);

            services.AddTransient <IDataContext, SecurityDataContext>((s)
                                                                      => new SecurityDataContext(connection));

            var mapper = new AcubecMapper(new SecurityMapper());

            services.AddSingleton(typeof(IMapper), mapper);
            services.AddUtilities();
            return(services);
        }
예제 #3
0
        public static IServiceCollection AddGateway(this IServiceCollection services, IConfiguration configuration)
        {
            ContextFactory.RegisterObject(new GatewayContext(services, configuration));


            var mapper = new AcubecMapper(new GatewayMapper());

            services.AddSingleton(typeof(IMapper), mapper);
            services.AddUtilities();

            services.AddHttpClient("SecurityFactory", client =>
            {
                client.BaseAddress = new Uri(configuration["SecurityBaseURL"]);
            });

            return(services);
        }