public UnitTest1() { string connectionString = @"Data Source=OTAVIO\SQLEXPRESS;Initial Catalog=IgrejaDB;Integrated Security=True"; var serviceProvider = new ServiceCollection() .AddEntityFrameworkSqlServer() //.AddDbContext<IgrejaDbContext>(options => options.UseSqlServer(connectionString)) .AddTransient <IUsuarioRepository, UsuarioRepository>() .BuildServiceProvider(); var builder = new DbContextOptionsBuilder <IgrejaDbContext>(); builder.UseSqlServer(connectionString).UseInternalServiceProvider(serviceProvider); _context = new IgrejaDbContext(builder.Options); //serviceProvider.AddTransient<IUsuarioRepository, UsuarioRepository>(); }
public Repository(IgrejaDbContext context) { _context = context; }
public UsuarioRepository(IgrejaDbContext context) : base(context) { }