Beispiel #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <IHiperAcademiaContext, HiperAcademiaContext>(opt => opt.UseInMemoryDatabase(databaseName: "teste"));
            MigrateDatabase(services);

            services
            .AddMvc(m => { m.EnableEndpointRouting = false; })
            .SetCompatibilityVersion(CompatibilityVersion.Version_3_0);

            services.AddApiVersioning(s =>
            {
                s.DefaultApiVersion = new ApiVersion(1, 0);
                s.ReportApiVersions = true;
                s.AssumeDefaultVersionWhenUnspecified = true;
            });
            services.AddRazorPages();

            IoCServices.Register(services);
            IoCRepositories.Register(services);

            var mappingConfig = new MapperConfiguration(mc =>
            {
                mc.AddProfile(new HiperAcademiaProfile());
            });
            IMapper mapper = mappingConfig.CreateMapper();

            services.AddSingleton(mapper);
        }
        // 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)
        {
            services.AddDbContext <IHiperAcademiaContext, HiperAcademiaContext>(opt => opt.UseInMemoryDatabase(databaseName: "teste"));

            MigrateDatabase(services);

            services.AddMvc(m => { m.EnableEndpointRouting = false; });

            IoCRepositories.Register(services);
            IoCServices.Register(services);

            var mappingConfig = new MapperConfiguration(mc =>
            {
                mc.AddProfile(new HiperAcademiaProfile());
            });
            IMapper mapper = mappingConfig.CreateMapper();

            services.AddSingleton(mapper);
        }