public CardItemService(IDBConfig settings) { var client = new MongoClient(settings.ConnectionString); var database = client.GetDatabase(settings.DatabaseName); _cardItems = database.GetCollection <CardItem>(settings.CollectionName); }
public static IDatabaseConnector Get(IDBConfig config) { if (!typeMap.ContainsKey(config.DatabaseType)) { if (!map.ContainsKey(config.DatabaseType)) { throw new InvalidOperationException($"Could not find an appropriate DatabaseConnector for database type {config.DatabaseType}"); } Assembly a; try { a = AppDomain.CurrentDomain.Load(File.ReadAllBytes(Path.GetFullPath(map[config.DatabaseType] + ".dll"))); //a = Assembly.LoadFile( Path.GetFullPath( map[Environment.OSVersion.Platform] + ".dll" ) ); } catch (Exception inner) { throw new InvalidProgramException($"Could not load the required library, {map[config.DatabaseType] + ".dll"}, for the database type {config.DatabaseType}.", inner); } var connType = (from t in a.FindTypesByBaseClass <IDatabaseConnector>() where config.DatabaseType.ToLower() == t.GetAttribute <DatabaseConnectorAttribute>()?.DBType?.ToLower() select t).FirstOrDefault(); if (connType == null) { throw new InvalidOperationException($"Could not find an appropriate DatabaseConnector Type for {config.DatabaseType} in assembly {map[config.DatabaseType] + ".dll"}"); } typeMap[config.DatabaseType] = connType; } return((IDatabaseConnector)Activator.CreateInstance(typeMap[config.DatabaseType], new object?[] { config })); }
public DBAccess(IDBConfig settings) { this.settings = settings; string uri = @$ " mongodb://{ settings.User } :{ settings.Password } @{ settings.Host }
private Control GetPanelControl(EnumDBType enuDBType) { m_currentConfig = ConfigService.CreateConfigModel(enuDBType); m_currentDBConfig = DBViewerConfig.Create(GetDBTypeNode(enuDBType)); Control ctl = m_currentConfig.GetConfigPanel(m_currentDBConfig); return(ctl); }
public SimpleTwitterModel(IDBConfig dbConfig) { mongoClient = new MongoClient( dbConfig.GetDBHost()); IMongoDatabase db = mongoClient.GetDatabase( dbConfig.GetDBName()); tweetCollection = db.GetCollection <SimpleTwitter>("SimpleTwitter"); }
public JoinController(joinDB DBController, joinServiceController Service, IDBConfig config) { this.joinDatabase = DBController; this.postService = Service; this.configDB = config; postService.joinEvent += joinEventFromService; postService.showList += postMemberList; postService.cancelEvent += cancelEventFromService; }
//The constructor uses the IDBConfig to connect to the database. public DBAccess(IDBConfig dBConfig) { try { Config = dBConfig; Client = new MongoClient(Config.ConnectionString); Database = Client.GetDatabase(Config.Database); Collection = Database.GetCollection <Script>(Config.Collection); } catch (MongoException me) { throw new Exception("Something went wrong when trying to connect to the database", me); } }
public EmgController(EmgPostController post, EmgDBGet DBget, IDBConfig DBconfig) { this.post = post; this.DBget = DBget; this.DBconfig = DBconfig; //イベントの登録 post.notificationTime += EmgEventNotify; post.todayEmgOrder += TodayEmgOrder; //内容がすべて同じなので同じイベントで post.changeDay += NextDayEvent; post.MaintainTime += TodayEmgOrder; post.tomorrowEmgOrder += TomorrowEmgOrder; post.LodosNotify += endLodos; InitaddWords(); }
public void init(string DBaddress, string database, string user, string password, string botname, ulong channelID, string token) { this.DBaddress = DBaddress; this.database = database; this.user = user; this.password = password; this.botname = botname; this.channelID = channelID; this.token = token; //覇者の紋章コンストラクタ chpData = new PostgreSQL_ChpRead(DBaddress, database, user, password); chpTimeDB = new PostgreSQL_chp_confDB(DBaddress, database, user, password); chpDBCon = new chpDB(chpData, chpTimeDB); chpPost = new emgPostToDiscord(token, channelID, botname); chpPostCon = new ChpPostController(chpPost); chpCon = new ChpController(chpDBCon, chpPostCon); //緊急クエストコンストラクタ emgDBRead = new PostgreSQL_EmgRead(DBaddress, database, user, password); configDB = new PostgreSQL_configLoader(DBaddress, database, user, password); emgPost = new emgPostToDiscord(token, channelID, botname); emgPostCon = new EmgPostController(emgPost); EmgDB = new EmgDBGet(emgDBRead); EmgCon = new EmgController(emgPostCon, EmgDB, configDB); //緊急クエスト参加コンストラクタ joinMemDB = new PostgreSQL_joinDB(DBaddress, database, user, password); joinPost = new joinPostDiscord(token, channelID, botname); jDB = new joinDB(joinMemDB, emgDBRead); joinSerCon = new joinServiceController(joinPost); joinCon = new JoinController(jDB, joinSerCon, configDB); //その他コンストラクタ List <AbstractServiceController> lstService = new List <AbstractServiceController>(); lstService.Add(chpPostCon); lstService.Add(emgPostCon); lstService.Add(joinSerCon); discord = new DiscordService(token, channelID, botname); defCon = new DefaultDiscordController(discord, lstService); }
private void ConfigureFuentMigratior(IServiceCollection services, IDBConfig dBConfig) { string connectionString = dBConfig.ConnectionString; services.AddFluentMigratorCore().ConfigureRunner(rb => rb.AddSQLite().WithGlobalConnectionString(connectionString).ScanIn(typeof(Startup).Assembly).For.Migrations()).AddLogging(lb => lb.AddFluentMigratorConsole()); }
public AccountService(IDatabaseService databaseService, IDBConfig dbConfig) { _databaseService = databaseService; _dbConfig = dbConfig; }
public AgentsRepository(IDBConfig dBConfig, ILogger <AgentsRepository> logger) { _connectionString = dBConfig.ConnectionString; _logger = logger; }
public HddMetricsRepository(IDBConfig dBConfig) { _connectionString = dBConfig.ConnectionString; }
public DBService(IConfiguration configuration, IDBConfig DBConfig) : base(configuration) { _DBConfig = DBConfig; stringConn = _DBConfig.GetDBConnection; }
public OrderService(IDatabaseService databaseService, IDBConfig dbConfig) { _databaseService = databaseService; _dbConfig = dbConfig; }
public FuncionarioRepository(IDBConfig DBConfig) { _DBConfig = DBConfig; }
private ContextManager(IDBConfig dbConfig) =>
protected DatabaseConnector(IDBConfig config) { DbName = config.DatabaseName; ConnectionString = config.ConnectionString; }
public SimpleTwitterController(IDBConfig dbConfig) { simpleTwitterModel = new SimpleTwitterModel(dbConfig); }
public MRBSConfigurationManager(IDBConfig config) { ConnectionString = config.Connection; }
public DotNetMetricsRepository(IDBConfig dBConfig, ILogger <DotNetMetricsRepository> logger) { _connectionString = dBConfig.ConnectionString; _logger = logger; }
public DatabaseConnector(IDBConfig config) : base(config) { }