protected MongoRepository()
        {
            _mongoContext = new TContext();

            //Entity Class'larının üzerinde ki BsonDiscriminator
            var className = typeof(TEntity).CustomAttributes.Select(p => p.ConstructorArguments[0].Value).FirstOrDefault().ToString();

            _dbCollection = _mongoContext.GetCollection <TEntity>(className);
        }
Beispiel #2
0
 protected BaseRepository(IMongoBookDBContext context)
 {
     _mongoContext = context;
     _dbCollection = _mongoContext.GetCollection <TEntity>(typeof(TEntity).Name);
 }
Beispiel #3
0
 public BookController(IMongoBookDBContext context)
 {
     _context      = context;
     _dbCollection = _context.GetCollection <Book>(typeof(Book).Name);
 }
 public StudentRepository(IMongoBookDBContext context) : base(context)
 {
 }
Beispiel #5
0
 public UserService(ILogger <UserService> logger, IMongoBookDBContext context)
 {
     _logger       = logger;
     _mongoContext = context;
     _dbCollection = _mongoContext.GetCollection <Users>("Users");
 }
 public BookRepository(IMongoBookDBContext context) : base(context)
 {
 }