src/Misc/EFTools/EntityDesign/VisualStudio/VsUtils.cs
// <summary>
//     Gets the <see cref="DbProviderServices" /> type of the modern (or non-legacy) provider for the
//     specified invariant name
// </summary>
Gets the  type of the modern (or non-legacy) provider for the
specified invariant name
Gets the type of the modern ( or non - legacy ) provider for the specified invariant name
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
        private static Type GetModernProvider(string providerInvariantName, Project project, IServiceProvider serviceProvider)
        {
            Debug.Assert(!string.IsNullOrWhiteSpace(providerInvariantName), "providerInvariantName is null or empty.");
            Debug.Assert(project != null, "project is null.");
            Debug.Assert(serviceProvider != null, "serviceProvider is null.");
            Debug.Assert(
                providerInvariantName != "Microsoft.SqlServerCe.Client.4.0",
                "providerInvariantName is for design-time.");
            var modernProvider = GetKnownModernProvider(providerInvariantName);
            if (modernProvider == null)
            {
                try
                {
                    var providerServicesTypeName = GetModernProviderTypeNameFromProject(
                        providerInvariantName,
                        project,
                        serviceProvider);
                    if (providerServicesTypeName != null)
                    {
                        modernProvider = GetTypeFromProject(providerServicesTypeName, project, serviceProvider);
                    }
                }
                catch (Exception ex)
                {
                    Debug.Fail(ex.ToString());
                }
            }
            Debug.Assert(
                modernProvider == null
                || (modernProvider != typeof(DbProviderServices)
                    && typeof(DbProviderServices).IsAssignableFrom(modernProvider)),
                "modernProvider does not a derive from DbProviderServices");
            return modernProvider;
        }
[ SuppressMessage ( " " , " " ) ] private static Type GetModernProvider ( string providerInvariantName , Project project , IServiceProvider serviceProvider ) { Debug . Assert ( ! string . IsNullOrWhiteSpace ( providerInvariantName ) , " " ) ; Debug . Assert ( project != null , " " ) ; Debug . Assert ( serviceProvider != null , " " ) ; Debug . Assert ( providerInvariantName != " " , " " ) ; var modernProvider = GetKnownModernProvider ( providerInvariantName ) ; if ( modernProvider == null ) { try { var providerServicesTypeName = GetModernProviderTypeNameFromProject ( providerInvariantName , project , serviceProvider ) ; if ( providerServicesTypeName != null ) { modernProvider = GetTypeFromProject ( providerServicesTypeName , project , serviceProvider ) ; } } catch ( Exception ex ) { Debug . Fail ( ex . ToString ( ) ) ; } } Debug . Assert ( modernProvider == null || ( modernProvider != typeof ( DbProviderServices ) && typeof ( DbProviderServices ) . IsAssignableFrom ( modernProvider ) ) , " " ) ; return modernProvider ; }
Gets the  type of the modern (or non-legacy) provider for the
specified invariant name
Gets the type of the modern ( or non - legacy ) provider for the specified invariant name
// If unknown, detect EF6 providers installed in the user's project
providerInvariantName
string
project
Project
serviceProvider
IServiceProvider