public EfGenericRepository(IArticlesDbContext context) { if (context == null) { throw new ArgumentException("An instance of DbContext is required to use this repository.", "context"); } this.Context = context; this.DbSet = this.Context.Set <T>(); }
public ArticleRepository(IArticlesDbContext context) { try { _context = context; _articles = _context.GetCollection <Article>(); } catch (Exception e) { Debug.WriteLine($"MongoDB database didn't connect.\tException message: {e.Message}"); } }