CTT/Server/Model/Module/DB/DBComponent.cs

32 lines
679 B
C#
Executable File
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

using System.Collections.Generic;
using System.Text;
using MongoDB.Driver;
namespace ET
{
/// <summary>
/// 用来缓存数据
/// </summary>
public class DBComponent : Entity
{
public static DBComponent Instance;
public List<string> Transfers = new List<string>();
public const int TaskCount = 32;
public MongoClient mongoClient;
public IMongoDatabase database;
public IMongoCollection<T> GetCollection<T>(string collection=null)
{
return this.database.GetCollection<T>(collection ?? typeof (T).Name);
}
public IMongoCollection<Entity> GetCollection(string name)
{
return this.database.GetCollection<Entity>(name);
}
}
}