static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); GeneratorForm gf = new GeneratorForm(); System.Collections.Specialized.NameValueCollection settings = ConfigurationManager.AppSettings; gf.Server = settings["Server"]; gf.Database = settings["Database"]; gf.OutputDir = settings["OutputDir"]; gf.NameSpace = settings["Namespace"]; // due to limitations on out parameters, we have to set a local bool, then assign to a property bool b; bool.TryParse(settings["Partial"], out b); gf.Partial = b; bool.TryParse(settings["PropertyEvents"], out b); gf.PropertyEvents = b; bool.TryParse(settings["Validation"], out b); gf.Validation = b; // allow command line arguments to over-ride app config if (args.Length == 3) { gf.Server = args[0]; gf.Database = args[1]; gf.OutputDir = args[2]; } Application.Run(gf); }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); GeneratorForm gf = new GeneratorForm(); System.Collections.Specialized.NameValueCollection settings = ConfigurationManager.AppSettings; gf.Server = settings["Server"]; gf.Database = settings["Database"]; gf.OutputDir = settings["OutputDir"]; gf.NameSpace = settings["Namespace"]; // due to limitations on out parameters, we have to set a local bool, then assign to a property bool b; bool.TryParse(settings["Partial"], out b); gf.Partial = b; bool.TryParse(settings["PropertyEvents"], out b); gf.PropertyEvents = b; bool.TryParse(settings["Validation"], out b); gf.Validation = b; // allow command line arguments to over-ride app config if (args.Length == 3) { gf.Server = args[0]; gf.Database = args[1]; gf.OutputDir = args[2]; } Application.Run(gf); }