コード例 #1
0
ファイル: EntityFrameworkIoC.cs プロジェクト: walterjun/Clima
        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);
        }
コード例 #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);
        }