From 8cb29182f4c548f70ee767ece919244511286ece Mon Sep 17 00:00:00 2001 From: mikkelhm Date: Tue, 1 Aug 2017 12:19:26 +0200 Subject: [PATCH] The try catch for getting a user when we are in Upgrading state also needs to work for SqlCe --- src/Umbraco.Core/Services/UserService.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Core/Services/UserService.cs b/src/Umbraco.Core/Services/UserService.cs index 48192e49d5..4cfc26daf2 100644 --- a/src/Umbraco.Core/Services/UserService.cs +++ b/src/Umbraco.Core/Services/UserService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data.Common; using System.Data.SqlClient; +using System.Data.SqlServerCe; using System.Globalization; using System.Linq; using System.Linq.Expressions; @@ -205,9 +206,9 @@ namespace Umbraco.Core.Services { return repository.GetByUsername(username, includeSecurityData: true); } - catch (SqlException ex) + catch (Exception ex) when (ex is SqlException || ex is SqlCeException) { - //we need to handle this one specific case which is when we are upgrading to 7.6 since the user group + //we need to handle this one specific case which is when we are upgrading to 7.7 since the user group //tables don't exist yet. This is the 'easiest' way to deal with this without having to create special //version checks in the BackOfficeSignInManager and calling into other special overloads that we'd need //like "GetUserById(int id, bool includeSecurityData)" which may cause confusion because the result of @@ -219,7 +220,6 @@ namespace Umbraco.Core.Services } throw; } - } } @@ -704,9 +704,9 @@ namespace Umbraco.Core.Services var result = repository.Get(id); return result; } - catch (SqlException ex) + catch (Exception ex) when (ex is SqlException || ex is SqlCeException) { - //we need to handle this one specific case which is when we are upgrading to 7.6 since the user group + //we need to handle this one specific case which is when we are upgrading to 7.7 since the user group //tables don't exist yet. This is the 'easiest' way to deal with this without having to create special //version checks in the BackOfficeSignInManager and calling into other special overloads that we'd need //like "GetUserById(int id, bool includeSecurityData)" which may cause confusion because the result of