Ejemplo n.º 1
0
        public MySQLEngine(IOptions <MySQLOptions> options, ILoggerFactory loggerFactory)
        {
            MySqlConnectorLogManager.Provider = new MicrosoftExtensionsLoggingLoggerProvider(loggerFactory);

            _options = options.Value;

            SetConnectionStrings();
        }
Ejemplo n.º 2
0
        public MySQLEngine(MySQLOptions options) : this()
        {
            //MySqlConnectorLogManager.Provider = new MicrosoftExtensionsLoggingLoggerProvider(loggerFactory);

            _options = options;

            SetConnectionStrings();
        }
Ejemplo n.º 3
0
        public MySQLEngine(IOptions <MySQLOptions> options, ILoggerFactory loggerFactory, ILogger <MySQLEngine> logger)
        {
            try
            {
#if !DEBUG
                MySqlConnectorLogManager.Provider = new MicrosoftExtensionsLoggingLoggerProvider(loggerFactory);
#endif
            }
            catch (InvalidOperationException ex)
            {
                GlobalSettings.Logger.LogError(ex, $"Connections:{SerializeUtil.ToJson(options.Value.Connections)}");
            }

            _options = options.Value;
            _logger  = logger;

            DatabaseNames = _options.Connections.Select(s => s.DatabaseName);

            SetConnectionStrings();

            _logger.LogInformation($"MySQLEngine初始化完成");
        }
Ejemplo n.º 4
0
 public MySQLBuilder(MySQLOptions mySQLOptions)
 {
     _mysqlOptions = mySQLOptions;
 }