public static LogViewerManager CreateManager(ILogViewerRepository repository = null, IDbConnectionFactory connectionFactory = null) { if (repository == null) repository = new LogViewerRepository(); if (connectionFactory == null && repository.DbFactory == null) { if (ConfigurationManager.ConnectionStrings["LoggingConnection"] == null) { connectionFactory = new OrmLiteConnectionFactory( ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString, SqlServerOrmLiteDialectProvider.Instance); repository.DbFactory = connectionFactory; } else { connectionFactory = new OrmLiteConnectionFactory( ConfigurationManager.ConnectionStrings["LoggingConnection"].ConnectionString, SqlServerOrmLiteDialectProvider.Instance); repository.DbFactory = connectionFactory; } } return new LogViewerManager { LogViewerRepo = repository }; }
public static LogViewerManager CreateManager(ILogViewerRepository repository = null, IDbConnectionFactory connectionFactory = null) { if (repository == null) { repository = new LogViewerRepository(); } if (connectionFactory == null && repository.DbFactory == null) { if (ConfigurationManager.ConnectionStrings["LoggingConnection"] == null) { connectionFactory = new OrmLiteConnectionFactory( ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString, SqlServerOrmLiteDialectProvider.Instance); repository.DbFactory = connectionFactory; } else { connectionFactory = new OrmLiteConnectionFactory( ConfigurationManager.ConnectionStrings["LoggingConnection"].ConnectionString, SqlServerOrmLiteDialectProvider.Instance); repository.DbFactory = connectionFactory; } } return(new LogViewerManager { LogViewerRepo = repository }); }