static public esSettings Load(string pathAndFileName) { esSettings settings = null; string version = GetFileVersion(pathAndFileName); if (version.Substring(0, 4) != "2011" && version.Substring(0, 4) != "2012") { // Convert the old project file in place ConvertSettings(pathAndFileName); } using (TextReader rdr = new StreamReader(pathAndFileName)) { XmlSerializer serializer = new XmlSerializer(typeof(esSettings)); settings = (esSettings)serializer.Deserialize(rdr); rdr.Close(); } if (!Directory.Exists(TemplateCachePath)) { Directory.CreateDirectory(TemplateCachePath); } if (settings.DriverInfoCollection == null || settings.driverInfoCollection.Count == 0) { settings.DriverInfoCollection.Add(new esSettingsDriverInfo() { Driver = settings.Driver, ConnectionString = settings.ConnectionString }); } return(settings); }
private static void ConvertSettings(string fileNameAndFilePath) { esSettings2010 settings2010 = new esSettings2010(); settings2010.Load(fileNameAndFilePath); esSettings settings = settings2010.To2011(); esSettingsDriverInfo info = new esSettingsDriverInfo(); info.ConnectionString = settings2010.ConnectionString; info.Driver = settings2010.Driver; settings.DriverInfoCollection.Add(info); try { AdjustPathsBasedOnPriorVersions(settings, @"Software\EntitySpaces 2009", "ES2009", false); AdjustPathsBasedOnPriorVersions(settings, @"Software\EntitySpaces 2010", "ES2010", false); AdjustPathsBasedOnPriorVersions(settings, @"Software\EntitySpaces 2011", "ES2011", false); AdjustPathsBasedOnPriorVersions(settings, @"Software\EntitySpaces 2011", "ES2012", true); } catch { } FileInfo fileInfo = new FileInfo(fileNameAndFilePath); string backup = fileInfo.Name.Replace(fileInfo.Extension, ""); backup += "_original" + fileInfo.Extension; backup = fileInfo.DirectoryName + "\\" + backup; File.Copy(fileNameAndFilePath, backup, true); settings.Save(fileNameAndFilePath); }
static internal Root Create(esSettings settings) { Root esMeta = new Root(settings); if (!esMeta.Connect(settings.Driver, settings.ConnectionString)) { throw new Exception("Unable to Connect to Database"); } esMeta.Language = "C#"; return esMeta; }
public esSettings Clone() { IFormatter formatter = new BinaryFormatter(); Stream stream = new MemoryStream(); formatter.Serialize(stream, this); stream.Seek(0, SeekOrigin.Begin); esSettings clone = (esSettings)formatter.Deserialize(stream); stream.Flush(); stream.Close(); return(clone); }
static public esSettings Load(XmlReader reader) { esSettings settings = null; XmlSerializer serializer = new XmlSerializer(typeof(esSettings)); settings = (esSettings)serializer.Deserialize(reader); if (settings.DriverInfoCollection == null || settings.driverInfoCollection.Count == 0) { settings.DriverInfoCollection.Add(new esSettingsDriverInfo() { Driver = settings.Driver, ConnectionString = settings.ConnectionString }); } return(settings); }
/// <summary> /// Loads the user's default settings. /// If none exist, a file is created with the EntitySpaces default settings. /// </summary> static public esSettings Load() { esSettings settings = null; string pathAndFileName = AppDataPath + @"\esSettings.xml"; if (!Directory.Exists(AppDataPath)) { Directory.CreateDirectory(AppDataPath); } if (!File.Exists(pathAndFileName)) { settings = SetDefaultSettings(); settings.Save(); } using (TextReader rdr = new StreamReader(pathAndFileName)) { XmlSerializer serializer = new XmlSerializer(typeof(esSettings)); settings = (esSettings)serializer.Deserialize(rdr); rdr.Close(); } if (!Directory.Exists(TemplateCachePath)) { Directory.CreateDirectory(TemplateCachePath); } if (settings.DriverInfoCollection == null || settings.driverInfoCollection.Count == 0) { settings.DriverInfoCollection.Add(new esSettingsDriverInfo() { Driver = settings.Driver, ConnectionString = settings.ConnectionString }); } return(settings); }
public void LoadTemplates(ContextMenuStrip templateMenu, ContextMenuStrip subTemplateMenu, esSettings settings) { try { this.Settings = settings; if (this.TreeViewNodeSorter == null) { this.TreeViewNodeSorter = new NodeSorter(); InitializeComponent(); Template.SetTemplateCachePath(esSettings.TemplateCachePath); Template.SetCompilerAssemblyPath(Settings.CompilerAssemblyPath); } this.Nodes.Clear(); rootNode = this.Nodes.Add("Templates"); rootNode.ImageIndex = 2; rootNode.SelectedImageIndex = 2; rootNode.ContextMenuStrip = this.folderMenu; this.currentUIControls.Clear(); this.coll.Clear(); string[] files = Directory.GetFiles(Settings.TemplatePath, "*.est", SearchOption.AllDirectories); foreach (string file in files) { Template template = new Template(); TemplateHeader header = null; string[] nspace = null; try { // If this doesn't meet the criteria skip it and move on to the next file template.Parse(file); header = template.Header; if (header.Namespace == string.Empty) continue; nspace = header.Namespace.Split('.'); if (nspace == null || nspace.Length == 0) continue; } catch { continue; } // Okay, we have a valid template with a namespace ... TreeNode node = rootNode; TreeNode[] temp = null; // This foreach loop adds all of the folder entries based on // the namespace foreach (string entry in nspace) { temp = node.Nodes.Find(entry, true); if (temp == null || temp.Length == 0) { node = node.Nodes.Add(entry); node.Name = entry; } else { node = temp[0]; } node.ImageIndex = 2; node.SelectedImageIndex = 2; node.ContextMenuStrip = this.folderMenu; } // Now we add the final node, with the template icon and stash the Template // in the node's "Tag" property for later use when they execute it. node = node.Nodes.Add(template.Header.Title); node.Tag = template; node.ToolTipText = header.Description + " : " + header.Author + " (" + header.Version + ")" + Environment.NewLine; if (header.IsSubTemplate) { node.ImageIndex = 0; node.SelectedImageIndex = 0; node.ContextMenuStrip = subTemplateMenu; } else { node.ImageIndex = 1; node.SelectedImageIndex = 1; node.ContextMenuStrip = templateMenu; } } // Now, let's sort it so it all makes sense ... this.Sort(); } catch { } }
public void Load(string fileNameAndFilePath, esSettings mainSettings) { userSettings = mainSettings; string version = GetFileVersion(fileNameAndFilePath); if (version != null && version.Substring(0, 4) != "2011" && version.Substring(0, 4) != "2012") { // Convert the old project file in place ConvertProject(fileNameAndFilePath, mainSettings); } RootNode = null; Dictionary<int, esProjectNode> parents = new Dictionary<int, esProjectNode>(); using (XmlTextReader reader = new XmlTextReader(fileNameAndFilePath)) { projectFilePath = fileNameAndFilePath; reader.WhitespaceHandling = WhitespaceHandling.None; esProjectNode currentNode = null; reader.Read(); reader.Read(); if (reader.Name != "EntitySpacesProject") { throw new Exception("Invalid Project File: '" + fileNameAndFilePath + "'"); } reader.Read(); currentNode = new esProjectNode(); currentNode.Name = reader.GetAttribute("Name"); RootNode = currentNode; parents[reader.Depth] = currentNode; while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { switch (reader.LocalName) { case "Folder": currentNode = new esProjectNode(); currentNode.Name = reader.GetAttribute("Name"); parents[reader.Depth - 1].Children.Add(currentNode); parents[reader.Depth] = currentNode; break; case "RecordedTemplate": currentNode = new esProjectNode(); currentNode.Name = reader.GetAttribute("Name"); currentNode.IsFolder = false; int depth = reader.Depth; // <Template> reader.Read(); currentNode.Template = new Template(); // Path fixup to the template string path = reader.GetAttribute("Path"); path = path.Replace("{fixup}", userSettings.TemplatePath); path = path.Replace("\\\\", "\\"); currentNode.Template.Parse(path); // <Input> reader.Read(); XmlReader input = reader.ReadSubtree(); input.Read(); currentNode.Input = new Hashtable(); while (input.Read()) { string type = input.GetAttribute("Type"); string key = input.GetAttribute("Key"); string value = input.GetAttribute("Value"); if (key == "OutputPath") { value = FixupTheFixup(this.projectFilePath, value); } switch (type) { case "(null)": currentNode.Input[key] = null; break; case "System.String": currentNode.Input[key] = value; break; case "System.Char": currentNode.Input[key] = Convert.ToChar(value); break; case "System.DateTime": currentNode.Input[key] = Convert.ToDateTime(value); break; case "System.Decimal": currentNode.Input[key] = Convert.ToDecimal(value); break; case "System.Double": currentNode.Input[key] = Convert.ToDouble(value); break; case "System.Boolean": currentNode.Input[key] = Convert.ToBoolean(value); break; case "System.Int16": currentNode.Input[key] = Convert.ToInt16(value); break; case "System.Int32": currentNode.Input[key] = Convert.ToInt32(value); break; case "System.Int64": currentNode.Input[key] = Convert.ToInt64(value); break; case "System.Collections.ArrayList": ArrayList list = new ArrayList(); string[] items = value.Split(','); foreach (string item in items) { list.Add(item); } currentNode.Input[key] = list; break; } } // <Settings> reader.Read(); XmlReader settings = reader.ReadSubtree(); currentNode.Settings = new esSettings(); currentNode.Settings = esSettings.Load(settings); // Fixup Settings ... currentNode.Settings.TemplatePath = userSettings.TemplatePath; currentNode.Settings.OutputPath = userSettings.OutputPath; currentNode.Settings.UIAssemblyPath = userSettings.UIAssemblyPath; currentNode.Settings.CompilerAssemblyPath = userSettings.CompilerAssemblyPath; currentNode.Settings.LanguageMappingFile = userSettings.LanguageMappingFile; currentNode.Settings.UserMetadataFile = userSettings.UserMetadataFile; parents[depth - 1].Children.Add(currentNode); break; } } } } }
public void Save(string fileNameAndFilePath, esSettings mainSettings) { projectFilePath = fileNameAndFilePath; userSettings = mainSettings; XmlTextWriter writer = new XmlTextWriter(fileNameAndFilePath, System.Text.Encoding.UTF8); writer.Formatting = Formatting.Indented; writer.WriteStartDocument(); writer.WriteStartElement("EntitySpacesProject"); writer.WriteAttributeString("Version", "2012.1.0930.0"); Save(this.RootNode, writer); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Close(); }
private void ConvertProject(string fileNameAndFilePath, esSettings settings) { esProject2010 project2010 = new esProject2010(); project2010.Load(fileNameAndFilePath, settings); ConvertProjectNodeSettings(project2010.RootNode); esProject project = new esProject(); // Manually copy root node of tree into new project project.RootNode = new esProjectNode(); project.RootNode.Name = project2010.RootNode.Name; project.RootNode.IsFolder = project2010.RootNode.IsFolder; project.RootNode.Children = project2010.RootNode.Children; project.RootNode.Settings = project2010.RootNode.Settings; FileInfo fileInfo = new FileInfo(fileNameAndFilePath); string backup = fileInfo.Name.Replace(fileInfo.Extension, ""); backup += "_original" + fileInfo.Extension; backup = fileInfo.DirectoryName + "\\" + backup; File.Copy(fileNameAndFilePath, backup, true); // Now Save it in our new format project.Save(fileNameAndFilePath, settings); }
private void OpenSettingsFile(string filename) { Cursor oldCursor = Cursor.Current; try { Cursor.Current = Cursors.WaitCursor; this.MainWindow.Settings = Settings = esSettings.Load(filename); PopulateUI(); NofityControlsThatSettingsChanged(); mru.Push(filename); SaveMruList(); } catch (Exception ex) { mru.Remove(filename); this.SaveMruList(); this.ShowError(ex); } finally { Cursor.Current = oldCursor; } }
public void DisplayTemplateUI ( bool useCachedInput, Hashtable input, esSettings settings, Template template, OnTemplateExecute OnExecuteCallback, OnTemplateCancel OnCancelCallback ) { try { this.Template = template; TemplateDisplaySurface.MainWindow.OnTemplateExecuteCallback = OnExecuteCallback; TemplateDisplaySurface.MainWindow.OnTemplateCancelCallback = OnCancelCallback; TemplateDisplaySurface.MainWindow.CurrentTemplateDisplaySurface = this; if (template != null) { CurrentUIControls.Clear(); PopulateTemplateInfoCollection(); SortedList<int, esTemplateInfo> templateInfoCollection = coll.GetTemplateUI(template.Header.UserInterfaceID); if (templateInfoCollection == null || templateInfoCollection.Count == 0) { MainWindow.ShowError(new Exception("Template UI Assembly Cannot Be Located")); } this.esMeta = esMetaCreator.Create(settings); esMeta.Input["OutputPath"] = settings.OutputPath; if (useCachedInput) { if (CachedInput.ContainsKey(template.Header.UniqueID)) { Hashtable cachedInput = CachedInput[template.Header.UniqueID]; if (cachedInput != null) { foreach (string key in cachedInput.Keys) { esMeta.Input[key] = cachedInput[key]; } } } } if (input != null) { esMeta.Input = input; } MainWindow.tabControlTemplateUI.SuspendLayout(); foreach (esTemplateInfo info in templateInfoCollection.Values) { UserControl userControl = info.UserInterface.CreateInstance(esMeta, useCachedInput, MainWindow.ApplicationObject); CurrentUIControls.Add(info.TabOrder, userControl); TabPage page = new TabPage(info.TabTitle); page.Controls.Add(userControl); userControl.Dock = DockStyle.Fill; MainWindow.tabControlTemplateUI.TabPages.Add(page); MainWindow.ShowTemplateUIControl(); } MainWindow.tabControlTemplateUI.ResumeLayout(); if (CurrentUIControls.Count > 0) { MainWindow.ShowTemplateUIControl(); } } } catch (Exception ex) { MainWindow.ShowError(ex); } }
public static void AdjustPathsBasedOnPriorVersions(esSettings settings, string registry, string version, bool currentVersion) { // File Locations RegistryKey key = Registry.CurrentUser.OpenSubKey(registry, false); if (key != null) { string basePath = (string)key.GetValue("Install_Dir"); if (!basePath.EndsWith(@"\")) { basePath += @"\"; } if (!currentVersion) { if (settings.TemplatePath == basePath + @"CodeGeneration\Templates\") { settings.TemplatePath = string.Empty; } if (settings.UIAssemblyPath == basePath + @"CodeGeneration\Bin\UIAddIns\") { settings.UIAssemblyPath = string.Empty; } if (settings.CompilerAssemblyPath == basePath + @"CodeGeneration\Bin\") { settings.CompilerAssemblyPath = string.Empty; } if (settings.LanguageMappingFile == basePath + @"CodeGeneration\esLanguages.xml") { settings.LanguageMappingFile = string.Empty; } string appPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\EntitySpaces\" + version; if (settings.UserMetadataFile == appPath + @"\esUserData.xml") { settings.UserMetadataFile = string.Empty; } } else { if (settings.TemplatePath == string.Empty) { settings.TemplatePath = basePath + @"CodeGeneration\Templates\"; } if (settings.UIAssemblyPath == string.Empty) { settings.UIAssemblyPath = basePath + @"CodeGeneration\Bin\UIAddIns\"; } if (settings.CompilerAssemblyPath == string.Empty) { settings.CompilerAssemblyPath = basePath + @"CodeGeneration\Bin\"; } if (settings.LanguageMappingFile == string.Empty) { settings.LanguageMappingFile = basePath + @"CodeGeneration\esLanguages.xml"; } if (settings.UserMetadataFile == string.Empty) { settings.UserMetadataFile = AppDataPath + @"\esUserData.xml"; } } } }
public ProjectExecuter(string projectFile, esSettings mainSettings) { userSettings = mainSettings; project = new esProject(); project.Load(projectFile, userSettings); }
public Root(esSettings settings) { Reset(); this.settings = settings; }
public Utils(esSettings settings) { this.settings = settings; }
/// <summary> /// SetCamelCase sets the first character to lower case, /// trims spaces, underscores, and periods, and sets next to upper. /// (CamelCase in this context refers to the lowerCamelCase convention.) /// </summary> /// <example> /// <code> /// string tableName = SetCamelCase("MY_TABLE_NAME"); /// </code> /// The result is "myTableName" /// </example> public string SetCamelCase(string name, esSettings settings) { string convertedName = SetPascalCase(name, settings); string camelName = String.Empty; bool firstToLowered = false; for (int i = 0; i < convertedName.Length; i++) { if (Char.IsLetterOrDigit(convertedName[i])) { if (!firstToLowered) { camelName += Char.ToLower(convertedName[i]); firstToLowered = true; } else { camelName += convertedName[i]; } } else { // This could really only be a underscore camelName += convertedName[i]; } } return camelName; }
/// <summary> /// SetPascalCase sets the first character to upper case, /// trims spaces, underscores, and periods, and sets next to upper. /// (PascalCase is sometimes referred to as UpperCamelCase.) /// </summary> /// <example> /// <code> /// string tableName = SetPascalCase("MY_TABLE_NAME"); /// </code> /// The result is "MyTableName" /// </example> public string SetPascalCase(string name, esSettings settings) { string convertedName = String.Empty; bool next2upper = true; bool allUpper = true; // checks for names in all CAPS foreach (char c in name) { if (Char.IsLower(c)) { allUpper = false; break; } } foreach (char c in name) { if (Char.IsLetterOrDigit(c)) { if (!settings.UseRawNames) { if (next2upper) { convertedName += c.ToString().ToUpper(); next2upper = false; } else if (allUpper) { convertedName += c.ToString().ToLower(); } else { convertedName += c; } } else { convertedName += c; } } else if (c == '_' && (settings.PreserveUnderscores || settings.UseRawNames)) { convertedName += c; next2upper = true; } else { next2upper = true; } } if (Char.IsDigit(convertedName[0])) { convertedName = convertedName.Insert(0, "_"); } return convertedName; }
public esSettings To2011() { esSettings settings = new esSettings(); settings.AbstractPrefix = this.AbstractPrefix; settings.CollectionSuffix = this.CollectionSuffix; settings.CompilerAssemblyPath = this.CompilerAssemblyPath; settings.ConnectionString = this.ConnectionString; settings.DefaultTemplateDoubleClickAction = this.DefaultTemplateDoubleClickAction; settings.Driver = this.Driver; settings.EntitySuffix = this.EntitySuffix; // settings.InstallPath { get; } settings.LanguageMappingFile = this.LanguageMappingFile; settings.LicenseProxyDomainName = this.LicenseProxyDomainName; settings.LicenseProxyEnable = this.LicenseProxyEnable; settings.LicenseProxyPassword = this.LicenseProxyPassword; settings.LicenseProxyUrl = this.LicenseProxyUrl; settings.LicenseProxyUserName = this.LicenseProxyUserName; settings.ManyPrefix = this.ManyPrefix; settings.ManySeparator = this.ManySeparator; settings.ManySuffix = this.ManySuffix; settings.MetadataSuffix = this.MetadataSuffix; settings.OnePrefix = this.OnePrefix; settings.OneSeparator = this.OneSeparator; settings.OneSuffix = this.OneSuffix; settings.OutputPath = this.OutputPath; settings.PrefixWithSchema = this.PrefixWithSchema; settings.PreserveUnderscores = this.PreserveUnderscores; settings.ProcDelete = this.ProcDelete; settings.ProcInsert = this.ProcInsert; settings.ProcLoadAll = this.ProcLoadAll; settings.ProcLoadByPK = this.ProcLoadByPK; settings.ProcPrefix = this.ProcPrefix; settings.ProcSuffix = this.ProcSuffix; settings.ProcUpdate = this.ProcUpdate; settings.ProcVerbFirst = this.ProcVerbFirst; settings.ProxyStubSuffix = this.ProxyStubSuffix; settings.QuerySuffix = this.QuerySuffix; settings.SelfOnly = this.SelfOnly; settings.SwapNames = this.SwapNames; settings.TemplatePath = this.TemplatePath; settings.TurnOffDateTimeInClassHeaders = this.TurnOffDateTimeInClassHeaders; settings.UIAssemblyPath = this.UIAssemblyPath; settings.UseAssociativeName = this.UseAssociativeName; settings.UseNullableTypesAlways = this.UseNullableTypesAlways; settings.UseRawNames = this.UseRawNames; settings.UserMetadataFile = this.UserMetadataFile; settings.UseUpToPrefix = this.UseUpToPrefix; return settings; }
public static void AdjustPathsBasedOnPriorVersions(esSettings settings, string registry, string version, bool currentVersion) { // File Locations RegistryKey key = Registry.CurrentUser.OpenSubKey(registry, false); if (key != null) { string basePath = (string)key.GetValue("Install_Dir"); if (!basePath.EndsWith(@"\")) { basePath += @"\"; } if (!currentVersion) { if (settings.TemplatePath == basePath + @"CodeGeneration\Templates\") { settings.TemplatePath = string.Empty; } if (settings.UIAssemblyPath == basePath + @"CodeGeneration\Bin\UIAddIns\") { settings.UIAssemblyPath = string.Empty; } if (settings.CompilerAssemblyPath == basePath + @"CodeGeneration\Bin\") { settings.CompilerAssemblyPath = string.Empty; } if (settings.LanguageMappingFile == basePath + @"CodeGeneration\esLanguages.xml") { settings.LanguageMappingFile = string.Empty; } string appPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\EntitySpaces\" + version; if (settings.UserMetadataFile == appPath + @"\esUserData.xml") { settings.UserMetadataFile = string.Empty; } } else { if (settings.TemplatePath == string.Empty) { settings.TemplatePath = basePath + @"CodeGeneration\Templates\"; } if (settings.UIAssemblyPath == string.Empty) { settings.UIAssemblyPath = basePath + @"CodeGeneration\Bin\UIAddIns\"; } if (settings.CompilerAssemblyPath == string.Empty) { settings.CompilerAssemblyPath = basePath + @"CodeGeneration\Bin\"; } if (settings.LanguageMappingFile == string.Empty) { settings.LanguageMappingFile = basePath + @"CodeGeneration\esLanguages.xml"; } if (settings.UserMetadataFile == string.Empty) { settings.UserMetadataFile = AppDataPath + @"\esUserData.xml"; } } } }
/// <summary> /// Reads the default esPlugin naming conventions from esPluginSettings.xml /// (located in the MyGeneration Settings folder.) /// </summary> /// <remarks> /// The default settings can be overridden at runtime by setting the /// appropriate Property in template code. /// </remarks> public esPlugIn(esSettings settings) { this.Settings = settings; }
static public esSettings SetDefaultSettings() { esSettings settings = new esSettings(); // Connection settings.Driver = "SQL"; settings.ConnectionString = GetDefaultConnectionString(settings.Driver); // File Locations RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\EntitySpaces 2012", false); if (key != null) { string basePath = (string)key.GetValue("Install_Dir"); if (!basePath.EndsWith(@"\")) { basePath += @"\"; } settings.TemplatePath = basePath + @"CodeGeneration\Templates\"; settings.UIAssemblyPath = basePath + @"CodeGeneration\Bin\UIAddIns\"; settings.CompilerAssemblyPath = basePath + @"CodeGeneration\Bin\"; settings.LanguageMappingFile = basePath + @"CodeGeneration\esLanguages.xml"; } else { //========================================================================================= // Ultimately this branch of the "if" statement will never be used as there will always be // a registry setting //========================================================================================= settings.TemplatePath = @"C:\svn\architecture\ES2012\CodeGeneration\Templates"; settings.UIAssemblyPath = @"C:\SVN\architecture\ES2012\CodeGeneration\ClassLibraries\EntitySpaces.TemplateUI\bin\x86\Debug"; settings.CompilerAssemblyPath = @"C:\SVN\architecture\ES2012\CodeGeneration\StandAlone\bin\x86\Debug"; settings.LanguageMappingFile = @"C:\svn\architecture\ES2012\CodeGeneration\esLanguages.xml"; } settings.OutputPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); settings.UserMetadataFile = AppDataPath + @"\esUserData.xml"; // Class Names settings.AbstractPrefix = "es"; settings.EntitySuffix = ""; settings.CollectionSuffix = "Collection"; settings.QuerySuffix = "Query"; settings.MetadataSuffix = "Metadata"; settings.ProxyStubSuffix = "ProxyStub"; settings.PrefixWithSchema = false; // Stored Procedure Names settings.ProcPrefix = "proc_"; settings.ProcInsert = "Insert"; settings.ProcUpdate = "Update"; settings.ProcDelete = "Delete"; settings.ProcLoadAll = "LoadAll"; settings.ProcLoadByPK = "LoadByPrimaryKey"; settings.ProcSuffix = ""; settings.ProcVerbFirst = false; // Hierarchical Names settings.OnePrefix = ""; settings.OneSeparator = "By"; settings.OneSuffix = ""; settings.ManyPrefix = ""; settings.ManySeparator = "By"; settings.ManySuffix = "Collection"; settings.SelfOnly = false; settings.SwapNames = false; settings.UseAssociativeName = false; settings.UseUpToPrefix = true; // Miscellaneous settings.PreserveUnderscores = false; settings.UseRawNames = false; // Licensing settings.LicenseProxyUrl = string.Empty; settings.LicenseProxyUserName = string.Empty; settings.LicenseProxyPassword = string.Empty; settings.LicenseProxyDomainName = string.Empty; // Other settings.UseNullableTypesAlways = true; settings.TurnOffDateTimeInClassHeaders = false; settings.DefaultTemplateDoubleClickAction = "Execute"; return(settings); }
static public esSettings SetDefaultSettings() { esSettings settings = new esSettings(); // Connection settings.Driver = "SQL"; settings.ConnectionString = GetDefaultConnectionString(settings.Driver); // File Locations RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\EntitySpaces 2012", false); if (key != null) { string basePath = (string)key.GetValue("Install_Dir"); if (!basePath.EndsWith(@"\")) { basePath += @"\"; } settings.TemplatePath = basePath + @"CodeGeneration\Templates\"; settings.UIAssemblyPath = basePath + @"CodeGeneration\Bin\UIAddIns\"; settings.CompilerAssemblyPath = basePath + @"CodeGeneration\Bin\"; settings.LanguageMappingFile = basePath + @"CodeGeneration\esLanguages.xml"; } else { //========================================================================================= // Ultimately this branch of the "if" statement will never be used as there will always be // a registry setting //========================================================================================= settings.TemplatePath = @"C:\svn\architecture\ES2012\CodeGeneration\Templates"; settings.UIAssemblyPath = @"C:\SVN\architecture\ES2012\CodeGeneration\ClassLibraries\EntitySpaces.TemplateUI\bin\x86\Debug"; settings.CompilerAssemblyPath = @"C:\SVN\architecture\ES2012\CodeGeneration\StandAlone\bin\x86\Debug"; settings.LanguageMappingFile = @"C:\svn\architecture\ES2012\CodeGeneration\esLanguages.xml"; } settings.OutputPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); settings.UserMetadataFile = AppDataPath + @"\esUserData.xml"; // Class Names settings.AbstractPrefix = "es"; settings.EntitySuffix = ""; settings.CollectionSuffix = "Collection"; settings.QuerySuffix = "Query"; settings.MetadataSuffix = "Metadata"; settings.ProxyStubSuffix = "ProxyStub"; settings.PrefixWithSchema = false; // Stored Procedure Names settings.ProcPrefix = "proc_"; settings.ProcInsert = "Insert"; settings.ProcUpdate = "Update"; settings.ProcDelete = "Delete"; settings.ProcLoadAll = "LoadAll"; settings.ProcLoadByPK = "LoadByPrimaryKey"; settings.ProcSuffix = ""; settings.ProcVerbFirst = false; // Hierarchical Names settings.OnePrefix = ""; settings.OneSeparator = "By"; settings.OneSuffix = ""; settings.ManyPrefix = ""; settings.ManySeparator = "By"; settings.ManySuffix = "Collection"; settings.SelfOnly = false; settings.SwapNames = false; settings.UseAssociativeName = false; settings.UseUpToPrefix = true; // Miscellaneous settings.PreserveUnderscores = false; settings.UseRawNames = false; // Licensing settings.LicenseProxyUrl = string.Empty; settings.LicenseProxyUserName = string.Empty; settings.LicenseProxyPassword = string.Empty; settings.LicenseProxyDomainName = string.Empty; // Other settings.UseNullableTypesAlways = true; settings.TurnOffDateTimeInClassHeaders = false; settings.DefaultTemplateDoubleClickAction = "Execute"; return settings; }
private void toolStripButtonReloadDefault_Click(object sender, EventArgs e) { Cursor oldCursor = Cursor.Current; try { Cursor.Current = Cursors.WaitCursor; Settings = esSettings.Load(); PopulateUI(); NofityControlsThatSettingsChanged(); } catch (Exception ex) { this.ShowError(ex); } finally { Cursor.Current = oldCursor; } }