Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public virtual void ConfigureServices(IServiceCollection services)
        {
            var mapperConfig = new MapperConfiguration(
                cfg =>
            {
                MainObjectMapper.Configure(cfg);
                ApiObjectMapper.Configure(cfg);
            });
            IMapper mapper = mapperConfig.CreateMapper();

            services
            .AddSingleton(mapper)

            .AddMvc();

            DiaryCore.Init(services);
        }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            DiaryCore.Init(services);

            var mapperConfig = new MapperConfiguration(
                cfg =>
            {
                MainObjectMapper.Configure(cfg);
                ApiObjectMapper.Configure(cfg);
            });
            IMapper mapper = mapperConfig.CreateMapper();

            services
            .AddSingleton(mapper)
            .AddMvc()
            .AddViewLocalization()
            .AddApplicationPart(typeof(Api.Startup).GetTypeInfo().Assembly)
            .AddControllersAsServices();
        }