Exemplo n.º 1
0
        /// <summary>
        /// 重写的OnConfiguring方法
        /// </summary>
        /// <param name="optionsBuilder"></param>
        protected override void OnConfiguring(Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder)
        {
            base.OnConfiguring(optionsBuilder);

            MySqlConfig useConfig = ConfigPacker.GetConfigPacker().GetConfig <MySqlConfig>();

            optionsBuilder.UseMySql(useConfig.Connectstr);
        }
        public void test_connectToDatabase()
        {
            Services_OunceV6.startService_MySql();
            // check that the connection is working
            Assert.That(OunceMySql.isConnectionOpen());

            // load config and recheck connectoin
            MySqlConfig.setMySqlConnectionDetailsFromAppConfig();
            Assert.That(OunceMySql.refreshDbConnection());
            Assert.That(OunceMySql.isConnectionOpen());
            // set up a bad pwd
            OunceMySql.MySqlLoginUsername = "******";
            Assert.That(false == OunceMySql.refreshDbConnection());

            // reload config and recheck connection
            MySqlConfig.setMySqlConnectionDetailsFromAppConfig();
            Assert.That(OunceMySql.refreshDbConnection());
        }
Exemplo n.º 3
0
 public PaymentRepository(IOptions <MySqlConfig> mySqlConfig, ILogger logger)
 {
     _mySqlConfig = mySqlConfig.Value;
     _logger      = logger;
 }
Exemplo n.º 4
0
 public ReportServerRepository(MySqlConfig config)
 {
     this.connectionString = config.ConnectionString;
 }
Exemplo n.º 5
0
 public ContactRepository(IOptions <MySqlConfig> mySqlConfig)
 {
     _mySqlConfig = mySqlConfig.Value;
 }
 public AdminChannelRepository(MySqlConfig config)
 {
     this.connectionString = config.ConnectionString;
 }
 public SubscribedServerRepository(MySqlConfig config)
 {
     this.connectionString = config.ConnectionString;
 }
Exemplo n.º 8
0
 public TransactionRepository(IOptions <MySqlConfig> mySqlConfig, IMapper mapper, ILogger logger)
 {
     _mySqlConfig = mySqlConfig.Value;
     _mapper      = mapper;
     _logger      = logger;
 }
Exemplo n.º 9
0
 public MicroserviceConfig(MySqlConfig defaultMySql, string authAlias)
 {
     this.mysql     = defaultMySql;
     this.authAlias = authAlias;
 }
Exemplo n.º 10
0
 public ServerServiceFixture WithServerRepository(MySqlConfig config)
 {
     serverRepository = new ServerRepository(config);
     return(this);
 }
Exemplo n.º 11
0
 public AppointmentRepository(IOptions<MySqlConfig> mySqlConfig)
 {
     _mySqlConfig = mySqlConfig.Value;
 }
Exemplo n.º 12
0
 public ChatChannelServerRepository(MySqlConfig config)
 {
     this.connectionString = config.ConnectionString;
 }