Beispiel #1
0
        internal override IServiceCollection AddOrm(IServiceCollection services, IConfiguration configuration = null)
        {
            IConfiguration dbConnectionSettings = ResolveConfiguration.GetConnectionSettings(configuration);
            string         conn = dbConnectionSettings.GetConnectionString("DefaultConnection");

            services.AddDbContext <AplicacaoContexto>(options => options.UseMySQL(conn));

            services.AddScoped(typeof(IRepositorioAsync <>), typeof(RepositorioAsync <>));
            services.AddScoped <IConsultaRepositorio, ConsultaRepositorio>();

            return(services);
        }
Beispiel #2
0
        internal override IServiceCollection AddOrm(IServiceCollection services, IConfiguration configuration = null)
        {
            IConfiguration dbConnectionSettings = ResolveConfiguration.GetConnectionSettings(configuration);
            string         conn = dbConnectionSettings.GetConnectionString("DefaultConnection");

            services.AddDbContext <ApplicationContext>(options => options.UseSqlServer(conn));

            services.AddScoped(typeof(IRepositoryAsync <>), typeof(RepositoryAsync <>));
            services.AddScoped <IProdutoRepository, ProdutoRepository>();

            return(services);
        }