// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var stringConexao = Configuration.GetConnectionString("ContextoGeral"); services.AddDbContext <ContextoGeralEF>(options => options.UseSqlServer(stringConexao)); var contextoGeralDapper = new ContextoGeralDapper(stringConexao); services.AddSingleton(contextoGeralDapper); //EF services.AddScoped <IEditorasRep, EditorasRep>(); services.AddScoped <IAutoresRep, AutoresRep>(); //Dapper services.AddScoped <ILivrosRep, LivrosRep>(); services.AddMvc(); }
public LivrosRep(ContextoGeralDapper ctx) { this.ctx = ctx; }