// The provider manifest token helps to distinguish between store versions. // We have only one backend version. // However, use the connection passed in to determine whether // the provider is local provider or remote provider // /// <summary> /// Returns provider manifest token for a given connection. /// </summary> /// <param name="connection">Connection to find manifest token from.</param> /// <returns>The provider manifest token for the specified connection.</returns> protected override string GetDbProviderManifestToken(DbConnection connection) { Check.NotNull(connection, "connection"); // vamshikb: Do we need to validate the connection and connection string // before returning the ProviderManifestToken???? // Determine the type of DbConnection // This method should never be called at runtime, so the provider // must be remote provider. // Throw if it is none. // if (connection.GetType() == typeof(SqlCeConnection)) { _isLocalProvider = true; } else if (RemoteProviderHelper.CompareObjectEqualsToType(connection, RemoteProvider.SqlCeConnection)) { _isLocalProvider = false; } else { throw ADP1.Argument(EntityRes.GetString(EntityRes.Mapping_Provider_WrongConnectionType, "SqlCeConnection")); } return(SqlCeProviderManifest.Token40); }
// Private helper for validatingn the SqlCeConnection. private void ValidateConnection(DbConnection connection) { // Check whether it is a valid SqlCeConnection. var isValid = _isLocalProvider ? connection is SqlCeConnection : RemoteProviderHelper.CompareObjectEqualsToType(connection, RemoteProvider.SqlCeConnection); if (!isValid) { throw ADP1.InvalidConnectionType(); } }