public QueryController(IDatabasePlugin database) { _database = database; }
public UploadController(IDatabasePlugin database, ILogger <UploadController> logger) { _database = database; _logger = logger; }
private static int RunFromCommandLine(string[] args) { var handle = NativeMethods.GetConsoleWindow(); if (handle == IntPtr.Zero) { NativeMethods.AllocConsole(); } else { NativeMethods.ShowWindow(handle, 5); } string objects; Profile template = ParseCommandLineArguments(args, out objects); IDatabasePlugin databasePlugin = null; ShowTitle(); if (template.DatabaseType == DatabaseTypes.Unknown) { Console.WriteLine(@"You must select a database type with the ""sql-plugin="" switch!"); Console.WriteLine(@" sql-plugin=SqlServer"); Console.WriteLine(@" sql-plugin=MySql"); Console.WriteLine(@" sql-plugin=Sqlite"); Console.WriteLine(@" sql-plugin=MsAccess"); return(101); } if (template.DatabaseType == DatabaseTypes.SqlServer) { databasePlugin = new SqlServer { DatabaseName = template.SqlServerDatabaseName, DatabasePort = template.SqlServerPort, DatabaseServer = template.SqlServerServerName, OutputDirectory = template.OutputFolder, Password = template.SqlServerPassword, TrustedConnection = template.SqlServerTrustedConnection, UserName = template.SqlServerUserName, Objects = objects, DefaultSchema = template.SqlServerDefaultSchema, IncludeComments = template.IncludeComments, ProgressBar = null, DataNamespaceName = template.DataNameSpace, BusinessNamespaceName = template.BusinessNameSpace, AutoRightTrimStrings = template.AutomaticallyRightTrimData, HasCustomConnectionString = template.SqlServerUseCustomConnectionString, CustomConnectionString = template.SqlServerCustomConnectionString, HasDynamicDataRetrieval = template.EnableDynamicDataRetrieval, AllowSerialization = template.AllowSerialization, PluralizationTemplate = template.PluralizationTemplate, Language = template.Language }; } if (template.DatabaseType == DatabaseTypes.MySql) { databasePlugin = new DatabasePlugins.MySql { DatabaseName = template.MySqlDatabaseName, DatabasePort = template.MySqlPort, DatabaseServer = template.MySqlServerName, OutputDirectory = template.OutputFolder, Password = template.MySqlPassword, UserName = template.MySqlUserName, Objects = objects, IncludeComments = template.IncludeComments, ProgressBar = null, DataNamespaceName = template.DataNameSpace, BusinessNamespaceName = template.BusinessNameSpace, AutoRightTrimStrings = template.AutomaticallyRightTrimData, HasCustomConnectionString = template.SqlServerUseCustomConnectionString, CustomConnectionString = template.SqlServerCustomConnectionString, HasDynamicDataRetrieval = template.EnableDynamicDataRetrieval, AllowSerialization = template.AllowSerialization, PluralizationTemplate = template.PluralizationTemplate, Language = template.Language }; } if (template.DatabaseType == DatabaseTypes.Sqlite) { databasePlugin = new Sqlite { DatabaseName = template.SqliteFileName, OutputDirectory = template.OutputFolder, Password = template.SqlitePassword, Objects = objects, IncludeComments = template.IncludeComments, ProgressBar = null, DataNamespaceName = template.DataNameSpace, BusinessNamespaceName = template.BusinessNameSpace, AutoRightTrimStrings = template.AutomaticallyRightTrimData, HasCustomConnectionString = template.SqlServerUseCustomConnectionString, CustomConnectionString = template.SqlServerCustomConnectionString, HasDynamicDataRetrieval = template.EnableDynamicDataRetrieval, AllowSerialization = template.AllowSerialization, PluralizationTemplate = template.PluralizationTemplate, Language = template.Language }; } if (template.DatabaseType == DatabaseTypes.MsAccess) { databasePlugin = new MsAccess { DatabaseName = template.AccessFileName, OutputDirectory = template.OutputFolder, Password = template.AccessPassword, Objects = objects, IncludeComments = template.IncludeComments, ProgressBar = null, DataNamespaceName = template.DataNameSpace, BusinessNamespaceName = template.BusinessNameSpace, AutoRightTrimStrings = template.AutomaticallyRightTrimData, HasCustomConnectionString = template.SqlServerUseCustomConnectionString, CustomConnectionString = template.SqlServerCustomConnectionString, HasDynamicDataRetrieval = template.EnableDynamicDataRetrieval, AllowSerialization = template.AllowSerialization, PluralizationTemplate = template.PluralizationTemplate, Language = template.Language }; } try { if (databasePlugin != null) { databasePlugin.CreateLayers(); } } catch { return(1); } return(0); }