private void Button2Click(object sender, EventArgs e) { // Validate that the info needed is there if (_schemaFactory == null) { MessageBox.Show("You need to click Load to load the database before you can generate the source files"); return; } if (string.IsNullOrWhiteSpace(textBox2.Text)) { MessageBox.Show("You need to fill in the Source Directory"); return; } if (!Directory.Exists(textBox2.Text)) { MessageBox.Show("The Source Directory must be a valid existent directory"); return; } if (string.IsNullOrWhiteSpace(textBox3.Text)) { MessageBox.Show("You need to fill in the Namespace"); return; } // Init Solution info Solution.Solution solution = new Solution.Solution(); Solution.BaseDirectory = textBox2.Text; Solution.Namespace = textBox3.Text; if (Solution.Settings == null) Solution.Settings = new Solution.SolutionSettings(); if (Solution.Settings.LinqSettings == null) Solution.Settings.LinqSettings = new Solution.LinqSettings(); Solution.Settings.LinqSettings.Generate = true; Solution.Settings.LinqSettings.MakeDataContextCSFile = chkGenerateDataContextClass.Checked; // Generate the Linq files var linqGenerator = new LinqGenerator(Solution, _schemaFactory); linqGenerator.Generate(); // Generate the FNH Files var FNHGenerator = new FluentNHGenerator(Solution, _schemaFactory); FNHGenerator.Generate(); // Generate the HBM files var hbmGenerator = new HBMGenerator(Solution, _schemaFactory); hbmGenerator.Generate(); MessageBox.Show(string.Format("All Source files have been written to: {0}", textBox2.Text)); }
public Form1() { InitializeComponent(); if (Solution == null) Solution = new Solution.Solution(); }