diff --git a/src/EntityFramework/Properties/Resources.cs b/src/EntityFramework/Properties/Resources.cs index 6817d50dca..3af7d4b4cf 100644 --- a/src/EntityFramework/Properties/Resources.cs +++ b/src/EntityFramework/Properties/Resources.cs @@ -902,14 +902,6 @@ internal static string MultiplePropertiesMatchedAsKeys(object p0, object p1) return EntityRes.GetString(EntityRes.MultiplePropertiesMatchedAsKeys, p0, p1); } - // - // A string like "Connection to the database failed. The connection string is configured with an invalid LocalDB server name. This may have been set in 'global.asax' by a pre-release version of MVC4. The default connection factory is now set in web.config so the line in 'global.asax' starting with 'Database.DefaultConnectionFactory = ' should be removed. See http://go.microsoft.com/fwlink/?LinkId=243166 for details." - // - internal static string BadLocalDBDatabaseName - { - get { return EntityRes.GetString(EntityRes.BadLocalDBDatabaseName); } - } - // // A string like "An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application's config file. See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. See the inner exception for details of the failure." // @@ -14005,6 +13997,14 @@ internal static string TransactionDisposedLog(object p0, object p1) { return EntityRes.GetString(EntityRes.TransactionDisposedLog, p0, p1); } + + // + // A string like "Unable to load embedded resource '{1}' from assembly '{0}'." + // + internal static string UnableToLoadEmbeddedResource(object p0, object p1) + { + return EntityRes.GetString(EntityRes.UnableToLoadEmbeddedResource, p0, p1); + } } // @@ -15757,7 +15757,6 @@ internal sealed class EntityRes internal const string DuplicateConfiguredColumnOrder = "DuplicateConfiguredColumnOrder"; internal const string UnsupportedUseOfV3Type = "UnsupportedUseOfV3Type"; internal const string MultiplePropertiesMatchedAsKeys = "MultiplePropertiesMatchedAsKeys"; - internal const string BadLocalDBDatabaseName = "BadLocalDBDatabaseName"; internal const string FailedToGetProviderInformation = "FailedToGetProviderInformation"; internal const string DbPropertyEntry_CannotGetCurrentValue = "DbPropertyEntry_CannotGetCurrentValue"; internal const string DbPropertyEntry_CannotSetCurrentValue = "DbPropertyEntry_CannotSetCurrentValue"; @@ -17395,6 +17394,7 @@ internal sealed class EntityRes internal const string TransactionHandler_AlreadyInitialized = "TransactionHandler_AlreadyInitialized"; internal const string ConnectionDisposedLog = "ConnectionDisposedLog"; internal const string TransactionDisposedLog = "TransactionDisposedLog"; + internal const string UnableToLoadEmbeddedResource = "UnableToLoadEmbeddedResource"; private static EntityRes loader; private readonly ResourceManager resources; diff --git a/src/EntityFramework/Properties/Resources.resx b/src/EntityFramework/Properties/Resources.resx index b25093d334..de1e5b7abb 100644 --- a/src/EntityFramework/Properties/Resources.resx +++ b/src/EntityFramework/Properties/Resources.resx @@ -525,9 +525,6 @@ Multiple potential primary key properties named '{0}' but differing only by case were found on entity type '{1}'. Configure the primary key explicitly using the HasKey fluent API or the KeyAttribute data annotation. ## ExceptionType=InvalidOperationException - - Connection to the database failed. The connection string is configured with an invalid LocalDB server name. This may have been set in 'global.asax' by a pre-release version of MVC4. The default connection factory is now set in web.config so the line in 'global.asax' starting with 'Database.DefaultConnectionFactory = ' should be removed. See http://go.microsoft.com/fwlink/?LinkId=243166 for details. - An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application's config file. See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. See the inner exception for details of the failure. diff --git a/src/EntityFramework/Utilities/DbProviderServicesExtensions.cs b/src/EntityFramework/Utilities/DbProviderServicesExtensions.cs index 1975e9ab95..8c5aa5ca1d 100644 --- a/src/EntityFramework/Utilities/DbProviderServicesExtensions.cs +++ b/src/EntityFramework/Utilities/DbProviderServicesExtensions.cs @@ -22,13 +22,6 @@ public static string GetProviderManifestTokenChecked( } catch (ProviderIncompatibleException ex) { - var dataSource = DbInterception.Dispatch.Connection.GetDataSource(connection, new DbInterceptionContext()); - if (@"(localdb)\v11.0".Equals(dataSource, StringComparison.OrdinalIgnoreCase) - || @"(localdb)\mssqllocaldb".Equals(dataSource, StringComparison.OrdinalIgnoreCase)) - { - throw new ProviderIncompatibleException(Strings.BadLocalDBDatabaseName, ex); - } - throw new ProviderIncompatibleException(Strings.FailedToGetProviderInformation, ex); } } diff --git a/test/EntityFramework/UnitTests/Utilities/DbProviderServicesExtensionsTests.cs b/test/EntityFramework/UnitTests/Utilities/DbProviderServicesExtensionsTests.cs index 9af925300a..bfe1b16a98 100644 --- a/test/EntityFramework/UnitTests/Utilities/DbProviderServicesExtensionsTests.cs +++ b/test/EntityFramework/UnitTests/Utilities/DbProviderServicesExtensionsTests.cs @@ -2,10 +2,8 @@ namespace System.Data.Entity.Utilities { - using System.Data.Common; using System.Data.Entity.Core; using System.Data.Entity.Core.Common; - using System.Data.Entity.Infrastructure.Interception; using System.Data.Entity.Resources; using System.Data.SqlClient; using Moq; @@ -15,53 +13,9 @@ namespace System.Data.Entity.Utilities public class DbProviderServicesExtensionsTests { [Fact] - public void Useful_exception_is_thrown_by_GetProviderManifestTokenChecked_if_bad_MVC4_connection_string_is_used() + public void Useful_exception_is_thrown_by_GetProviderManifestTokenChecked() { - Useful_exception_is_thrown_by_GetProviderManifestTokenChecked_if_bad_connection_string_is_used( - "Data Source=(localdb)\v11.0", Strings.BadLocalDBDatabaseName); - } - - [Fact] - public void Useful_exception_is_thrown_by_GetProviderManifestTokenChecked_if_general_bad_connection_string_is_used() - { - Useful_exception_is_thrown_by_GetProviderManifestTokenChecked_if_bad_connection_string_is_used( - "Data Source=WotNoServer", Strings.FailedToGetProviderInformation); - } - - [Fact] - public void Useful_exception_is_thrown_by_GetProviderManifestTokenChecked_if_correct_LocalDB_name_is_used_but_it_still_fails() - { - Useful_exception_is_thrown_by_GetProviderManifestTokenChecked_if_bad_connection_string_is_used( - "Data Source=(localdb)\\v11.0", Strings.FailedToGetProviderInformation); - } - - [Fact] - public void GetProviderManifestTokenChecked_uses_interception() - { - var dbConnectionInterceptorMock = new Mock(); - DbInterception.Add(dbConnectionInterceptorMock.Object); - try - { - Useful_exception_is_thrown_by_GetProviderManifestTokenChecked_if_bad_connection_string_is_used( - "Data Source=WotNoServer", Strings.FailedToGetProviderInformation); - } - finally - { - DbInterception.Remove(dbConnectionInterceptorMock.Object); - } - - dbConnectionInterceptorMock.Verify( - m => m.DataSourceGetting(It.IsAny(), It.IsAny>()), - Times.Once()); - dbConnectionInterceptorMock.Verify( - m => m.DataSourceGot(It.IsAny(), It.IsAny>()), - Times.Once()); - } - - private void Useful_exception_is_thrown_by_GetProviderManifestTokenChecked_if_bad_connection_string_is_used( - string connectionString, string expectedMessage) - { - var fakeConnection = new SqlConnection(connectionString); + var fakeConnection = new SqlConnection("Data Source=AnyConnectionString"); var innerException = new ProviderIncompatibleException(); var mockProviderServices = new Mock(); @@ -73,7 +27,7 @@ private void Useful_exception_is_thrown_by_GetProviderManifestTokenChecked_if_ba var ex = Assert.Throws( () => mockProviderServices.Object.GetProviderManifestTokenChecked(fakeConnection)); - Assert.Equal(expectedMessage, ex.Message); + Assert.Equal(Strings.FailedToGetProviderInformation, ex.Message); Assert.Same(innerException, ex.InnerException); } }