本文整理汇总了C#中IMongoDatabase类的典型用法代码示例。如果您正苦于以下问题:C# IMongoDatabase类的具体用法?C# IMongoDatabase怎么用?C# IMongoDatabase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMongoDatabase类属于命名空间,在下文中一共展示了IMongoDatabase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CollectionExpression
public CollectionExpression(Alias alias, IMongoDatabase database, string collectionName, Type documentType)
: base(MongoExpressionType.Collection, typeof(void), alias)
{
CollectionName = collectionName;
Database = database;
DocumentType = documentType;
}
开发者ID:jango2015,项目名称:MongoDB_Client_.Net,代码行数:7,代码来源:CollectionExpression.cs
示例2: GetAllProducts
public ICollection<Product> GetAllProducts(IMongoDatabase database, string collectionName)
{
var collection = database.GetCollection<Product>(collectionName);
var rest = collection.Find(_ => true).ToListAsync().Result;
return rest;
}
开发者ID:ni4ka7a,项目名称:Molybdenum-Team,代码行数:7,代码来源:MongoImporter.cs
示例3: firstTimeInstallDataBase
private async void firstTimeInstallDataBase (IMongoDatabase database, string rootPath){
try {
if (!CollectionExistsAsync (database, "actors").Result) {
await database.CreateCollectionAsync ("actors");
var actors = new ActorRepository();
foreach (Actor actor in actors.Retrieve(rootPath))
{
var collectionActors = database.GetCollection<Actor>("actors");
await collectionActors.InsertOneAsync(actor);
}
}
if (!CollectionExistsAsync (database, "movies").Result) {
await database.CreateCollectionAsync ("movies");
var movies = new MovieRepository();
foreach (Movie movie in movies.Retrieve(rootPath))
{
var collectionActors = database.GetCollection<Movie>("movies");
await collectionActors.InsertOneAsync(movie);
}
}
}
catch {
throw;
}
}
开发者ID:RafaelDelboni,项目名称:Angular-WebAPI-MongoDB-TokenAuth,代码行数:28,代码来源:Bootstrapper.cs
示例4: MongoDBStorage
public MongoDBStorage(IMongoDatabase database)
{
Revisions = database.GetCollection<RevisionModel>("revisions");
Users = database.GetCollection<UserModel>("users");
Task.Run(() => SetUp()).Wait();
}
开发者ID:avgoncharov,项目名称:BuildRevisionCounter,代码行数:7,代码来源:MongoDBStorage.cs
示例5: GetCollection
public IMongoCollection<BsonDocument> GetCollection(IMongoDatabase mongoDatabase, bool? cappedCollection,
string collectionName, long? cappedCollectionSize, long? maxNumberOfDocuments)
{
IMongoCollection<BsonDocument> retVal = null;
if (cappedCollection == null || !cappedCollection.Value)
{
retVal = mongoDatabase.GetCollection<BsonDocument>(collectionName ?? CollectionDefaulName);
return retVal;
}
if (!IsCollectionExistsAsync(mongoDatabase, collectionName).Result)
{
CreateCollectionAsync(mongoDatabase, collectionName, cappedCollectionSize, maxNumberOfDocuments).Wait();
retVal = mongoDatabase.GetCollection<BsonDocument>(collectionName ?? CollectionDefaulName);
return retVal;
}
if (IsCappedCollection(collectionName, mongoDatabase).Result)
{
retVal = mongoDatabase.GetCollection<BsonDocument>(collectionName ?? CollectionDefaulName);
return retVal;
}
if (ConvertCollectionToCapped(collectionName, mongoDatabase, cappedCollectionSize, maxNumberOfDocuments).Result)
{
retVal = mongoDatabase.GetCollection<BsonDocument>(collectionName ?? CollectionDefaulName);
}
return retVal;
}
开发者ID:AzharIqbal84,项目名称:ForwardMongoLogger,代码行数:32,代码来源:MongoDbHelper.cs
示例6: TokenHandleStore
public TokenHandleStore(IMongoDatabase db,
StoreSettings settings,
IClientStore clientStore)
: base(db, settings.TokenHandleCollection)
{
_serializer = new TokenSerializer(clientStore);
}
开发者ID:nielsmeijssen,项目名称:IdentityServer.v3.MongoDb,代码行数:7,代码来源:TokenHandleStore.cs
示例7: AdminService
public AdminService(IMongoClient client, IMongoDatabase db, StoreSettings settings)
{
_client = client;
_db = db;
_settings = settings;
_clientSerializer = new ClientSerializer();
}
开发者ID:FeodorFitsner,项目名称:IdentityServer.v3.Admin.MongoDb,代码行数:7,代码来源:AdminService.cs
示例8: GetAllTraders
public ICollection<Trader> GetAllTraders(IMongoDatabase database)
{
var collection = database.GetCollection<Trader>(TradersCollectionName);
var rest = collection.Find(t => true).ToListAsync().Result;
return rest;
}
开发者ID:ni4ka7a,项目名称:Molybdenum-Team,代码行数:7,代码来源:MongoImporter.cs
示例9: MongoConfigurationRepository
public MongoConfigurationRepository(string connection, string databaseName)
{
var mongoClient = new MongoClient(MongoClientSettings.FromUrl(new MongoUrl(connection ?? Connection)));
database = mongoClient.GetDatabase(databaseName ?? DatabaseName);
InitCollection();
}
开发者ID:cimdalli,项目名称:DynamicConfigurator,代码行数:7,代码来源:MongoConfigurationRepository.cs
示例10: Init
public void Init()
{
Client = new MongoClient(ConnString);
DataBase = Client.GetDatabase("mongoLog");
Users = DataBase.GetCollection<User>("Users");
Datas = DataBase.GetCollection<Data>("Datas");
}
开发者ID:ozt88,项目名称:MongoLog,代码行数:7,代码来源:DBHelper.cs
示例11: MProjects
static MProjects()
{
var connectionString = Settings.Default.MongoConnectionString;
var mongoClient = new MongoClient(connectionString);
Database = mongoClient.GetDatabase(Settings.Default.MongoDBName);
}
开发者ID:DenysGranevych,项目名称:Denys-library,代码行数:7,代码来源:MProjects.cs
示例12: Querying
public Querying()
{
client = new MongoClient(); ;
database = client.GetDatabase("test");
collection = database.GetCollection<Student>("Users");
}
开发者ID:maximburyak,项目名称:TODA,代码行数:7,代码来源:Querying.cs
示例13: Logger
public Logger(string logger)
{
var client = new MongoClient(Properties.Settings.Default.Mongo_log);
_db = client.GetDatabase("patientcarelog");
_logCollection = _db.GetCollection<BsonDocument>("Logs");
_logger = logger;
}
开发者ID:dsb92,项目名称:patientcare,代码行数:7,代码来源:Logger.cs
示例14: DetailController
/// <summary>
/// Details controller constructor
/// </summary>
public DetailController()
{
var client = new MongoClient(ConfigurationManager.ConnectionStrings["Mongo_patientcare"].ConnectionString);
_log = new Logger("WebAPI:DetailController");
_db = client.GetDatabase("patientcaredb");
_details = _db.GetCollection<BsonDocument>("Detail");
}
开发者ID:dsb92,项目名称:patientcare,代码行数:10,代码来源:DetailController.cs
示例15: InitiateDatabase
private void InitiateDatabase()
{
var connectionString = ConfigurationManager.ConnectionStrings["Mongo.ConnectionString"].ConnectionString;
var mongoUrlBuilder = new MongoUrlBuilder(connectionString);
mongoClient = new MongoClient(mongoUrlBuilder.ToMongoUrl());
Database = mongoClient.GetDatabase(mongoUrlBuilder.DatabaseName);
}
开发者ID:tareq89,项目名称:TaskCat,代码行数:7,代码来源:DbContext.cs
示例16: PatientRepository
/// <summary />
public PatientRepository()
{
var client = new MongoClient(ConfigurationManager.ConnectionStrings["Mongo_patientcare_datamock"].ConnectionString);
_log = new Logger("WebAPI : PatientRepository");
_db = client.GetDatabase("patientcare_datamock");
_patients = _db.GetCollection<BsonDocument>("Patients");
}
开发者ID:dsb92,项目名称:patientcare,代码行数:8,代码来源:PatientRepository.cs
示例17: TodoItemRepository
public TodoItemRepository(string mongoConnection, string databaseName)
{
collectionName = "todoitems";
var client = new MongoClient(mongoConnection);
this.database = client.GetDatabase(databaseName);
this.collection = database.GetCollection<TodoItem>(collectionName);
}
开发者ID:CedricLeblond,项目名称:MultiChannelTodo,代码行数:7,代码来源:TodoItemRepository.cs
示例18: MongoDbBase
public MongoDbBase(string connectionString, string database)
{
this.connectionString = connectionString;
this.database = database;
Client = new MongoClient(connectionString);
Database = Client.GetDatabase(database);
}
开发者ID:Flavien,项目名称:mongodb-storage,代码行数:7,代码来源:MongoDbBase.cs
示例19: Initialize
public void Initialize()
{
var connect = "mongodb://localhost";
_client = new MongoClient(connect);
_db = _client.GetDatabase("local");
_collection = _db.GetCollection<Person>("Person");
}
开发者ID:overload17,项目名称:Database,代码行数:7,代码来源:DS_MONGODB.cs
示例20: ClothesDbContext
public ClothesDbContext(string connectionString)
{
var mongoClient = new MongoClient(connectionString);
_mongoDatabase = mongoClient.GetDatabase("ClothesWashing");
RegisterClassMaps();
}
开发者ID:georgiancamarasan,项目名称:ClothesWashing,代码行数:7,代码来源:ClothesDbContext.cs
注:本文中的IMongoDatabase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论