static void Main(string[] args) { /* * Example Connection String * server=.;initial catalog=MyDatabase;Integrated Security=SSPI; * server=.;initial catalog=MyDatabase;user id=sa;password=Password1; * * Example command line to create a database * /create /newdb:"MyDatabase" /master:"server=.;initial catalog=master;Integrated Security=SSPI;" /connectionstring:"server=.;initial catalog=MyDatabase;Integrated Security=SSPI;" * * Example command line to update a database * /update /connectionstring:"server=.;initial catalog=MyDatabase;Integrated Security=SSPI;" * * NOTE: To run this installer from Visual Studio, add one of the lines above to * this project's properties sheet, Debug tab, Application Arguments * */ System.Console.WriteLine("Starting Install..."); var stateSaver = new Dictionary <object, object>(); var installer = new DatabaseInstaller(); installer.Install(stateSaver); System.Console.WriteLine("Install Complete"); }
static void Main(string[] args) { //This class is added for convenience. If you wish to convert the installer to a console application //set its output type to "Console Application" and startup object to this class System.Console.WriteLine("Starting Install..."); var stateSaver = new Dictionary <object, object>(); var installer = new DatabaseInstaller(); installer.Install(stateSaver); System.Console.WriteLine("Install Complete"); }
static void Main(string[] args) { /* * Example Connection String * server=.;initial catalog=MyDatabase;Integrated Security=SSPI; * server=.;initial catalog=MyDatabase;user id=sa;password=Password1; * * Example command line to update a database * --update=true --connectionstring="server=.;initial catalog=MyDatabase;Integrated Security=SSPI;" * * NOTE: To run this installer from Visual Studio, add one of the lines above to * this project's properties sheet, Debug tab, Application Arguments * */ IConfiguration Configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile("appsettings.development.json", optional: true, reloadOnChange: true) .AddCommandLine(args) .AddEnvironmentVariables() .Build(); var allValues = Configuration.GetChildren().Select(x => new { x.Key, x.Value }).ToDictionary(x => x.Key.ToString(), x => x.Value?.ToString()); Log.Logger = new LoggerConfiguration() .ReadFrom.Configuration(Configuration) .CreateLogger(); Log.Information("Starting Install..."); try { var installer = new DatabaseInstaller(); installer.Install(allValues); } catch (Exception ex) { Log.Fatal(ex, "Install Exception"); } Log.Information("Install Complete"); }
static void Main(string[] args) { /* * Example Connection String * Server=localhost;Database=MyDatabase;UID=postgres;PWD=postgres; * * Example command line to create a database * /create /newdb:"MyDatabase" /master:"Server=localhost;Database=postgres;UID=postgres;PWD=postgres;" /connectionstring:"Server=localhost;Database=MyDatabase;UID=postgres;PWD=postgres;" * * Example command line to update a database * /update /connectionstring:"Server=localhost;Database=MyDatabase;UID=postgres;PWD=postgres;" * * NOTE: To run this installer from Visual Studio, add one of the lines above to * this project's properties sheet, Debug tab, Application Arguments * */ System.Console.WriteLine("Starting Install..."); var stateSaver = new Dictionary <object, object>(); var installer = new DatabaseInstaller(); installer.Install(stateSaver); System.Console.WriteLine("Install Complete"); }