src/EFTools/EntityDesign/VisualStudio/Package/ConnectionManager.cs
/// <summary>
///     Given an old metadata name and a new one, find the connection string keyed by the old metadata name in the hash,
///     update its metadata name, then rewrite the .config file.
/// </summary>
/// <param name="project">DTE Project that owns the .config file</param>
/// <param name="entityContainerName"></param>
/// <param name="newMetadata"></param>
Given an old metadata name and a new one, find the connection string keyed by the old metadata name in the hash,
update its metadata name, then rewrite the .config file.
Given an old metadata name and a new one find the connection string keyed by the old metadata name in the hash update its metadata name then rewrite the . config file .
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1614:ElementParameterDocumentationMustHaveText")]
        internal void UpdateMetadataName(Project project, string entityContainerName, string newMetadata)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }
            if (project.UniqueName.Equals(Constants.vsMiscFilesProjectUniqueName, StringComparison.Ordinal))
            {
                return;
            }
            if (String.IsNullOrEmpty(entityContainerName))
            {
                throw new ArgumentNullException("entityContainerName");
            }
            if (String.IsNullOrEmpty(newMetadata))
            {
                throw new ArgumentNullException("newMetadata");
            }
            lock (_hashSyncRoot)
            {
                ExtractConnStringsIntoHash(project, true);
                var localConnStringToChange = GetConnectionStringObject(project, entityContainerName);
                if (localConnStringToChange != null)
                {
                    localConnStringToChange.Builder.Metadata = newMetadata;
                    InsertConnStringsFromHash(project);
                }
                else
                {
                    var s = String.Format(CultureInfo.CurrentCulture, Resources.ConnectionManager_NoConnectionString, entityContainerName);
                    VsUtils.LogOutputWindowPaneMessage(project, s);
                }
            }
        }
[ SuppressMessage ( " " , " " ) ] internal void UpdateMetadataName ( Project project , string entityContainerName , string newMetadata ) { if ( project == null ) { throw new ArgumentNullException ( " " ) ; } if ( project . UniqueName . Equals ( Constants . vsMiscFilesProjectUniqueName , StringComparison . Ordinal ) ) { return ; } if ( String . IsNullOrEmpty ( entityContainerName ) ) { throw new ArgumentNullException ( " " ) ; } if ( String . IsNullOrEmpty ( newMetadata ) ) { throw new ArgumentNullException ( " " ) ; } lock ( _hashSyncRoot ) { ExtractConnStringsIntoHash ( project , true ) ; var localConnStringToChange = GetConnectionStringObject ( project , entityContainerName ) ; if ( localConnStringToChange != null ) { localConnStringToChange . Builder . Metadata = newMetadata ; InsertConnStringsFromHash ( project ) ; } else { var s = String . Format ( CultureInfo . CurrentCulture , Resources . ConnectionManager_NoConnectionString , entityContainerName ) ; VsUtils . LogOutputWindowPaneMessage ( project , s ) ; } } }
Given an old metadata name and a new one, find the connection string keyed by the old metadata name in the hash,
update its metadata name, then rewrite the .config file.
Given an old metadata name and a new one find the connection string keyed by the old metadata name in the hash update its metadata name then rewrite the . config file .
project
Project
DTE Project that owns the .config file
DTE Project that owns the . config file
entityContainerName
string
None
newMetadata
string
None