/// <summary> /// Removes the entity framework section from an existing web config file. /// </summary> private void RemoveEntityFrameworkSection() { Project activeProj = null; VSProject vsProj = null; DTE2 vsApp = MySqlDataProviderPackage.GetGlobalService(typeof(EnvDTE.DTE)) as EnvDTE80.DTE2; Array activeProjects = (Array)vsApp.ActiveSolutionProjects; if (activeProjects.Length > 0) { activeProj = (Project)activeProjects.GetValue(0); vsProj = activeProj.Object as VSProject; string projectPath = System.IO.Path.GetDirectoryName(activeProj.FullName); WebConfigTools.RemoveEFWebConfig(projectPath); } }
/// <summary> /// Adds the entity framework section to an existing web config file. /// </summary> /// <param name="EFVersion">The Entity Framework version.</param> /// <param name="mySqlVersion">The My SQL version.</param> private void AddEntityFrameworkSection(string EFVersion, string mySqlVersion) { Project activeProj = null; VSProject vsProj = null; DTE2 vsApp = MySqlDataProviderPackage.GetGlobalService(typeof(EnvDTE.DTE)) as EnvDTE80.DTE2; Array activeProjects = (Array)vsApp.ActiveSolutionProjects; if (activeProjects.Length > 0) { activeProj = (Project)activeProjects.GetValue(0); vsProj = activeProj.Object as VSProject; string projectPath = System.IO.Path.GetDirectoryName(activeProj.FullName); WebConfigTools.EFWebConfigTransformation(projectPath, EFVersion, mySqlVersion, _mySQLEF6Version); } }