Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            services.AddSwaggerGen(x =>
            {
                x.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info
                {
                    Title   = "Teste.Superdigital API",
                    Version = "v1"
                });
            });

            services.AddDbContext <DataContext>(optionsAction: option => option.UseSqlServer(Configuration.GetConnectionString(name: "ConnectionString")));

            (new Register()).RegisterClass(services, Configuration.GetConnectionString(name: "ConnectionString"));

            var     config = MapperHelper.CreateConfiguration();
            IMapper mapper = config.CreateMapper();

            services.AddSingleton(mapper);
        }