Inheritance: ILoggerMode
Exemplo n.º 1
0
        public static ILoggerMode getLoggerMode(LoggerMode mode)
        {
            //Create a new MySqlConnection if no viable one is available
            if (m_conn == null || m_conn.State != System.Data.ConnectionState.Open)
            {
                string connStr = BuildConnectionString();
                m_conn = new MySqlConnection(connStr);
            }

            ILoggerMode logger = null;

            if (mode == LoggerMode.EVENT)
            {
                logger = new EventLoggerMode();
            }
            else if (mode == LoggerMode.SESSION)
            {
                logger = new SessionLogger();
            }
            else
            {
                throw new ArgumentException("Invalid LoggerMode");
            }

            logger.SetConnection(m_conn);
            return(logger);
        }
Exemplo n.º 2
0
        public static ILoggerMode getLoggerMode(LoggerMode mode)
        {
            //Create a new MySqlConnection if no viable one is available
            if (m_conn == null || m_conn.State != System.Data.ConnectionState.Open)
            {
                string connStr = BuildConnectionString();
                m_conn = new MySqlConnection(connStr);
            }

            ILoggerMode logger = null;
            if (mode == LoggerMode.EVENT)
                logger = new EventLoggerMode();
            else if (mode == LoggerMode.SESSION)
                logger = new SessionLogger();
            else
                throw new ArgumentException("Invalid LoggerMode");

            logger.SetConnection(m_conn);
            return logger;
        }