Esempio 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.AddAutoMapper(typeof(MappingObj));
            RepositoryInjetor.Add(services);
            InjetorServices.Add(services);

            string connectionString = Configuration.GetConnectionString("Default");

            services.AddDbContext <ContasContext>(options =>
                                                  options.UseSqlServer(connectionString));
        }
Esempio n. 2
0
        private void ConfigureServices(IServiceCollection services)
        {
            // Context
            services.AddDbContext <ContasContext>(options => options.UseSqlServer(Configuration.GetConnectionString("Default")));

            // AutoMapper
            services.AddAutoMapper(typeof(MappingObj));


            // Serviços e Repositórios
            RepositoryInjetor.Add(services);
            InjetorServices.Add(services);
        }