Exemplo n.º 1
0
        private async Task ConfigureServicesAsync(IServiceCollection services)
        {
            var esConnection = await Defaults.GetConnection();

            var typeMapper = ConfigureTypeMapper();

            services.AddMvc();
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "Event Log API", Version = "v1"
                });
                c.IncludeXmlComments($"{AppDomain.CurrentDomain.BaseDirectory}/Marketplace.xml");
            });
            services.AddSingleton <IAggregateStore>(new GesAggregateStore(
                                                        (type, id) => $"{type.Name}-{id}",
                                                        esConnection,
                                                        new JsonNetSerializer(),
                                                        typeMapper
                                                        ));

            var openSession = ConfgiureRavenDb();

            var projectionManager = new ProjectionManager(
                esConnection,
                new RavenCheckpointStore(openSession),
                new JsonNetSerializer(),
                typeMapper,
                new [] { new ActiveClassifiedAds(openSession), });
            await projectionManager.Activate();
        }