Esempio n. 1
0
        public ProcessDAL()
        {
            // Create a Settings object with all Defaults
            DALSettingsSection dss = new DALSettingsSection();

            Settings = new DALSettings(dss);
        }
Esempio n. 2
0
        private void btnGen_Click(object sender, RoutedEventArgs e)
        {
            DALSettingsSection runSettings = new DALSettingsSection();

            runSettings.AddServiceExtensions            = this.cbAddServiceExtensions.IsChecked.Value;
            runSettings.BaseOutputFolder                = this.txtBaseOutputFolder.Text;
            runSettings.BaseTemplateFolder              = this.txtBaseTempate.Text;
            runSettings.ConnectionString                = this.txtConnString.Text;
            runSettings.ContextName                     = this.txtContextName.Text;
            runSettings.MakeObjectsPlural               = this.cbPlural.IsChecked.Value;
            runSettings.ModelNameSpace                  = this.txtModelNamespace.Text;
            runSettings.PluralizeCollections            = this.cbPluralCollections.IsChecked.Value;
            runSettings.RepositoryNameSpace             = this.txtRepoNamespace.Text;
            runSettings.RepositoryTemplateClassFile     = this.txtRepoClass.Text;
            runSettings.RepositoryTemplateFolder        = this.txtRepoTemplate.Text;
            runSettings.RepositoryTemplateInterfaceFile = this.txtRepoInterface.Text;
            runSettings.ServiceExtensionTemplateFolder  = this.txtSvcExtensionFolder.Text;
            runSettings.ServiceNameSpace                = this.txtServiceNamespace.Text;
            runSettings.ServiceTemplateClassFile        = this.txtServiceClass.Text;
            runSettings.ServiceTemplateFolder           = this.txtServiceTemplate.Text;
            runSettings.ServiceTemplateInterfaceFile    = this.txtServiceInterface.Text;
            runSettings.CreateOutputFolders             = this.cbCreateOutputFolders.IsChecked.Value;

            if (worker != null)
            {
                worker.RunWorkerAsync(runSettings);
                lblStatus.Text = "Generating files in the background.";
            }
            else
            {
                lblStatus.Text = "Critical Error!  Files not generated.";
            }
        }
Esempio n. 3
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            lblStatus.Text = "Specify new config";
            // Create OpenFileDialog
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

            // Set filter for file extension and default file extension
            dlg.DefaultExt = ".config";
            dlg.Filter     = "Config files (*.config)|*.config";

            // Display OpenFileDialog by calling ShowDialog method
            Nullable <bool> result = dlg.ShowDialog();

            // Get the selected file name and display in a TextBox
            if (result == true)
            {
                // Open document
                string filename            = dlg.FileName;
                ExeConfigurationFileMap fm = new ExeConfigurationFileMap();
                fm.ExeConfigFilename = filename;
                var conf = ConfigurationManager.OpenMappedExeConfiguration(fm, ConfigurationUserLevel.None);

                DALSettingsSection dss = (DALSettingsSection)conf.Sections["dalSettings"];

                DALSettings settings = new DALSettings(dss);

                this.DataContext = settings;

                lblStatus.Text = "New Config Loaded";
                return;
            }
            lblStatus.Text = "Ready";
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Simple test of constructing the objects...");
            DALSettingsSection dss = null;

            var config = ConfigurationManager.OpenExeConfiguration(null);

            dss = (DALSettingsSection)config.Sections["dalSettings"];

            Console.WriteLine("Looking for templates in this folder: " + dss.BaseTemplateFolder);

            DALSettings settings = new DALSettings(dss);
            ProcessDAL  pd       = new ProcessDAL(settings);

            if (pd.GenerateAllFiles())
            {
                Console.WriteLine("Files generated successfully.");
                Console.WriteLine("Please check the " + dss.BaseOutputFolder + " folder for results.");
            }
            else
            {
                Console.WriteLine("There was some sort of processing error.");
                Console.WriteLine("Check the log files.");
            }

            Console.Write("End of test.  Press Enter...");
            Console.ReadLine();
        }
Esempio n. 5
0
        void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            DALSettingsSection sect = e.Argument as DALSettingsSection;

            DALSettings settings = new DALSettings(sect);
            ProcessDAL  pd       = new ProcessDAL(settings);

            e.Result = pd.GenerateAllFiles();
        }
        public void SetupObjects()
        {
            // Read the settings from the config file.
            // Assume "App" file exists in the output folder
            var config = ConfigurationManager.OpenExeConfiguration(".\\App");

            _dssConfigured      = (DALSettingsSection)config.Sections["dalSettings"];
            _settingsConfigured = new DALSettings(_dssConfigured);

            _dssDefault      = new DALSettingsSection();
            _settingsDefault = new DALSettings(_dssDefault);
        }
Esempio n. 7
0
        public void SetupSettings()
        {
            // HACK to be able to load the config section.
            //using (var sw = File.CreateText(".\\App"))
            //{
            //    sw.Close();
            //}
            // Assuming the file "App" exists in the output folder.
            var config = ConfigurationManager.OpenExeConfiguration(".\\App");

            dss = (DALSettingsSection)config.Sections["dalSettings"];
        }
Esempio n. 8
0
        private void LoadSettingsSection()
        {
            DALSettingsSection dss = null;

            var config = ConfigurationManager.OpenExeConfiguration(null);

            dss = (DALSettingsSection)config.Sections["dalSettings"];

            Console.WriteLine("Looking for templates in this folder: " + dss.BaseTemplateFolder);

            DALSettings settings = new DALSettings(dss);

            this.DataContext = settings;
            ConfigureWorkerThread();
            lblStatus.Text = "Ready";
        }
 public void SetupSettings()
 {
     dss = new DALSettingsSection();
 }