コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UserRepository" /> class.
        /// </summary>
        /// <param name="settings">The DB settings.</param>
        public UserRepository(IAppDatabaseSettings settings)
        {
            var client   = new MongoClient(settings.ConnectionString);
            var database = client.GetDatabase(settings.DatabaseName);

            _users = database.GetCollection <User>(settings.UsersCollectionName);
        }
コード例 #2
0
        public TodoService(IAppDatabaseSettings appDatabaseSettings)
        {
            var client   = new MongoClient(appDatabaseSettings.ConnectionString);
            var database = client.GetDatabase(appDatabaseSettings.DatabaseName);

            _todos = database.GetCollection <TodoModel>(appDatabaseSettings.TodosCollectionName);
        }