예제 #1
0
        public CardItemService(IDBConfig settings)
        {
            var client   = new MongoClient(settings.ConnectionString);
            var database = client.GetDatabase(settings.DatabaseName);

            _cardItems = database.GetCollection <CardItem>(settings.CollectionName);
        }
예제 #2
0
        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 }));
        }
예제 #3
0
        public DBAccess(IDBConfig settings)
        {
            this.settings = settings;

            string uri = @$ "
        mongodb://{ settings.User }
        :{ settings.Password }
        @{ settings.Host }
예제 #4
0
        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");
        }
예제 #6
0
        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;
        }
예제 #7
0
 //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);
     }
 }
예제 #8
0
        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();
        }
예제 #9
0
        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);
        }
예제 #10
0
        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());
        }
예제 #11
0
 public AccountService(IDatabaseService databaseService, IDBConfig dbConfig)
 {
     _databaseService = databaseService;
     _dbConfig        = dbConfig;
 }
예제 #12
0
 public AgentsRepository(IDBConfig dBConfig, ILogger <AgentsRepository> logger)
 {
     _connectionString = dBConfig.ConnectionString;
     _logger           = logger;
 }
예제 #13
0
 public HddMetricsRepository(IDBConfig dBConfig)
 {
     _connectionString = dBConfig.ConnectionString;
 }
예제 #14
0
 public DBService(IConfiguration configuration,
                  IDBConfig DBConfig) : base(configuration)
 {
     _DBConfig  = DBConfig;
     stringConn = _DBConfig.GetDBConnection;
 }
예제 #15
0
 public OrderService(IDatabaseService databaseService, IDBConfig dbConfig)
 {
     _databaseService = databaseService;
     _dbConfig        = dbConfig;
 }
 public FuncionarioRepository(IDBConfig DBConfig)
 {
     _DBConfig = DBConfig;
 }
예제 #17
0
 private ContextManager(IDBConfig dbConfig) =>
예제 #18
0
 protected DatabaseConnector(IDBConfig config)
 {
     DbName           = config.DatabaseName;
     ConnectionString = config.ConnectionString;
 }
예제 #19
0
 public SimpleTwitterController(IDBConfig dbConfig)
 {
     simpleTwitterModel = new SimpleTwitterModel(dbConfig);
 }
예제 #20
0
 public MRBSConfigurationManager(IDBConfig config)
 {
     ConnectionString = config.Connection;
 }
 public DotNetMetricsRepository(IDBConfig dBConfig, ILogger <DotNetMetricsRepository> logger)
 {
     _connectionString = dBConfig.ConnectionString;
     _logger           = logger;
 }
예제 #22
0
 public DatabaseConnector(IDBConfig config) : base(config)
 {
 }