src/Misc/EFTools/EntityDesign/VisualStudio/Package/ConnectionManager.cs
// <summary>
//     Translate an invariant name from design-time to runtime or vice versa
// </summary>
Translate an invariant name from design-time to runtime or vice versa
Translate an invariant name from design - time to runtime or vice versa
internal static string TranslateInvariantName(IServiceProvider serviceProvider, string invariantName, string connectionString, bool isDesignTime)
        {
            if (connectionString == null)
            {
                throw new ArgumentNullException("connectionString");
            }
            if (invariantName == null)
            {
                throw new ArgumentNullException("invariantName");
            }
            var translatedInvariantName = invariantName;
            var providerMapper = serviceProvider.GetService(typeof(IDTAdoDotNetProviderMapper)) as IDTAdoDotNetProviderMapper;
            var providerMapper2 = providerMapper as IDTAdoDotNetProviderMapper2;
            if (providerMapper2 != null)
            {
                if (isDesignTime)
                {
                    translatedInvariantName = providerMapper2.MapInvariantToRuntimeInvariantName(invariantName, connectionString, false);
                }
                else
                {
                    translatedInvariantName = providerMapper2.MapRuntimeInvariantToInvariantName(invariantName, connectionString, false);
                }
            }
            if (string.IsNullOrEmpty(translatedInvariantName))
            {
                translatedInvariantName = invariantName;
            }
            return translatedInvariantName;
        }
internal static string TranslateInvariantName ( IServiceProvider serviceProvider , string invariantName , string connectionString , bool isDesignTime ) { if ( connectionString == null ) { throw new ArgumentNullException ( " " ) ; } if ( invariantName == null ) { throw new ArgumentNullException ( " " ) ; } var translatedInvariantName = invariantName ; var providerMapper = serviceProvider . GetService ( typeof ( IDTAdoDotNetProviderMapper ) ) as IDTAdoDotNetProviderMapper ; var providerMapper2 = providerMapper as IDTAdoDotNetProviderMapper2 ; if ( providerMapper2 != null ) { if ( isDesignTime ) { translatedInvariantName = providerMapper2 . MapInvariantToRuntimeInvariantName ( invariantName , connectionString , false ) ; } else { translatedInvariantName = providerMapper2 . MapRuntimeInvariantToInvariantName ( invariantName , connectionString , false ) ; } } if ( string . IsNullOrEmpty ( translatedInvariantName ) ) { translatedInvariantName = invariantName ; } return translatedInvariantName ; }
Translate an invariant name from design-time to runtime or vice versa
Translate an invariant name from design - time to runtime or vice versa
serviceProvider
IServiceProvider
invariantName
string
connectionString
string
isDesignTime
bool