public ProductController(INoSqlDbFactory dbFactory) { var db = dbFactory.Create("test"); _productsCollection = db.GetCollection <Product>("products"); }
/// <summary> /// Contstructor: recieves a <paramref name="settings"/> object used /// for gainning access to the client database and appropriate collection. /// </summary> /// <param name="factory">NoSQL Database factory.</param> /// <param name="settings">Object cointaing the fields necessary for accessing the DB.</param> public PersonService(INoSqlDatabaseFactory factory, IDatabaseSettings settings) { var database = factory.Create(settings.ConnectionString, settings.DatabaseName); _people = database.GetCollection <Person>(settings.CollectionName); }