예제 #1
0
        internal ITransaction GetTransactionRepository()
        {
            ITransaction result = null;

            switch (_config.LoggerType)
            {
            case LoggingTypeModel.LogOutputType.TextFile:
                result = new TextLogger
                {
                    LogOutputFileLocation = _config.Text.FileInformation.LogFileLocation,
                    LogOutputFileName     = _config.Text.FileInformation.LogFileName
                };
                break;

            case LoggingTypeModel.LogOutputType.SQL:
                result = new SqlLogger();
                break;

            case LoggingTypeModel.LogOutputType.SQLite:
                result = new SqliteLogger();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(result);
        }
예제 #2
0
        internal ILogger GetLoggerRepository()
        {
            ILogger repo;

            switch (_config.LoggerType)
            {
            case LoggingTypeModel.LogOutputType.TextFile:
                var textOutput = new DirectoryInfo(_config.Text.FileInformation.LogFileLocation);
                if (!textOutput.Exists)
                {
                    textOutput.Create();
                }
                repo = new TextLogger
                {
                    LogOutputFileLocation = _config.Text.FileInformation.LogFileLocation,
                    LogOutputFileName     = _config.Text.FileInformation.LogFileName,
                    LoggingLevel          = _config.LoggingLevel
                };
                break;

            case LoggingTypeModel.LogOutputType.SQL:
                repo = new SqlLogger()
                {
                    LoggingLevel = _config.LoggingLevel
                };
                break;

            case LoggingTypeModel.LogOutputType.SQLite:
                var sqliteOutput = new DirectoryInfo(_config.SQLite.ServerInformation.LogFileLocation);
                if (!sqliteOutput.Exists)
                {
                    sqliteOutput.Create();
                }
                repo = new SqliteLogger()
                {
                    LoggingLevel = _config.LoggingLevel
                };
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(repo);
        }