From e8a7ee188156e7d6b6a08eaf3f6b2b5c58b002f5 Mon Sep 17 00:00:00 2001 From: Jiri Prajz Date: Thu, 27 Jan 2022 11:25:24 +0100 Subject: [PATCH 1/3] Architect throw exception when is Disconnected. Data constant/parameter not found. Parameter name: id Actual value was 9e301a8b-b356-42fa-ae57-3be3a28650d7. --- backend/OrigamArchitect/ArchitectWorkbench.cs | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/backend/OrigamArchitect/ArchitectWorkbench.cs b/backend/OrigamArchitect/ArchitectWorkbench.cs index 859c438d81..31a6304e25 100644 --- a/backend/OrigamArchitect/ArchitectWorkbench.cs +++ b/backend/OrigamArchitect/ArchitectWorkbench.cs @@ -2183,7 +2183,20 @@ IDeploymentService deployment #else ApplicationDataDisconnectedMode = !TestConnectionToApplicationDataDatabase(); - if (ApplicationDataDisconnectedMode) + IParameterService parameterService = + ServiceManager.Services.GetService(typeof(IParameterService)) as IParameterService; + + try + { + parameterService.RefreshParameters(); + } + catch (Exception ex) + { + // show the error but go on + // error can occur e.g. when duplicate constant name is loaded, e.g. due to incompatible packages + AsMessageBox.ShowError(this, ex.Message, strings.ErrorWhileLoadingParameters_Message, ex); + } + if (ApplicationDataDisconnectedMode) { UpdateTitle(); return; @@ -2218,19 +2231,6 @@ IDeploymentService deployment } #endif - IParameterService parameterService = - ServiceManager.Services.GetService(typeof(IParameterService)) as IParameterService; - - try - { - parameterService.RefreshParameters(); - } - catch(Exception ex) - { - // show the error but go on - // error can occur e.g. when duplicate constant name is loaded, e.g. due to incompatible packages - AsMessageBox.ShowError(this, ex.Message, strings.ErrorWhileLoadingParameters_Message, ex); - } #if ! ORIGAM_CLIENT // we have to initialize the new user after parameter service gets loaded From 21d25a9a43d2c0e507c16509920e7f5f98a83668 Mon Sep 17 00:00:00 2001 From: Jiri Prajz Date: Mon, 31 Jan 2022 07:05:01 +0100 Subject: [PATCH 2/3] FIX: PrepareParameters is needed for disconnected mode. --- backend/Origam.Services/IParameterService.cs | 3 +- .../ParameterService.cs | 2 +- backend/OrigamArchitect/ArchitectWorkbench.cs | 39 +++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/backend/Origam.Services/IParameterService.cs b/backend/Origam.Services/IParameterService.cs index 8a4721b608..e3fe1188cd 100644 --- a/backend/Origam.Services/IParameterService.cs +++ b/backend/Origam.Services/IParameterService.cs @@ -60,5 +60,6 @@ public interface IParameterService : IWorkbenchService decimal floatValue, decimal currencyValue, object dateValue, Guid? overridenProfileId); void RefreshParameters(); Guid ResolveLanguageId(String cultureString); - } + void PrepareParameters(); + } } diff --git a/backend/Origam.Workbench.Services/ParameterService.cs b/backend/Origam.Workbench.Services/ParameterService.cs index e5242bd409..b723625c93 100644 --- a/backend/Origam.Workbench.Services/ParameterService.cs +++ b/backend/Origam.Workbench.Services/ParameterService.cs @@ -577,7 +577,7 @@ private Hashtable FeatureList } } - private void PrepareParameters() + public void PrepareParameters() { lock(_constantsById) { diff --git a/backend/OrigamArchitect/ArchitectWorkbench.cs b/backend/OrigamArchitect/ArchitectWorkbench.cs index 31a6304e25..60a06230fc 100644 --- a/backend/OrigamArchitect/ArchitectWorkbench.cs +++ b/backend/OrigamArchitect/ArchitectWorkbench.cs @@ -2151,6 +2151,8 @@ private void _schema_SchemaLoaded(object sender, EventArgs e) OrigamEngine.InitializeSchemaItemProviders(_schema); IDeploymentService deployment = ServiceManager.Services.GetService(); + IParameterService parameterService = + ServiceManager.Services.GetService(typeof(IParameterService)) as IParameterService; #if ORIGAM_CLIENT deployment.CanUpdate(_schema.ActiveExtension); @@ -2181,24 +2183,12 @@ IDeploymentService deployment } } #else - ApplicationDataDisconnectedMode + ApplicationDataDisconnectedMode = !TestConnectionToApplicationDataDatabase(); - IParameterService parameterService = - ServiceManager.Services.GetService(typeof(IParameterService)) as IParameterService; - - try - { - parameterService.RefreshParameters(); - } - catch (Exception ex) - { - // show the error but go on - // error can occur e.g. when duplicate constant name is loaded, e.g. due to incompatible packages - AsMessageBox.ShowError(this, ex.Message, strings.ErrorWhileLoadingParameters_Message, ex); - } if (ApplicationDataDisconnectedMode) { - UpdateTitle(); + parameterService.PrepareParameters(); + UpdateTitle(); return; } bool isEmpty = deployment.IsEmptyDatabase(); @@ -2231,11 +2221,20 @@ IDeploymentService deployment } #endif - -#if ! ORIGAM_CLIENT - // we have to initialize the new user after parameter service gets loaded - // otherwise it would fail generating SQL statements - if (isEmpty) + try + { + parameterService.RefreshParameters(); + } + catch (Exception ex) + { + // show the error but go on + // error can occur e.g. when duplicate constant name is loaded, e.g. due to incompatible packages + AsMessageBox.ShowError(this, ex.Message, strings.ErrorWhileLoadingParameters_Message, ex); + } +#if !ORIGAM_CLIENT + // we have to initialize the new user after parameter service gets loaded + // otherwise it would fail generating SQL statements + if (isEmpty) { string userName = SecurityManager.CurrentPrincipal.Identity.Name; if (MessageBox.Show(string.Format(strings.AddUserToUserList_Question, From d215b4a633cf03f853789a127ae50abec64dcaff Mon Sep 17 00:00:00 2001 From: Jiri Prajz Date: Tue, 1 Feb 2022 16:33:24 +0100 Subject: [PATCH 3/3] FIX: improve typo. --- backend/OrigamArchitect/ArchitectWorkbench.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/OrigamArchitect/ArchitectWorkbench.cs b/backend/OrigamArchitect/ArchitectWorkbench.cs index 60a06230fc..ba7bbbe72b 100644 --- a/backend/OrigamArchitect/ArchitectWorkbench.cs +++ b/backend/OrigamArchitect/ArchitectWorkbench.cs @@ -2151,8 +2151,8 @@ private void _schema_SchemaLoaded(object sender, EventArgs e) OrigamEngine.InitializeSchemaItemProviders(_schema); IDeploymentService deployment = ServiceManager.Services.GetService(); - IParameterService parameterService = - ServiceManager.Services.GetService(typeof(IParameterService)) as IParameterService; + IParameterService parameterService + = ServiceManager.Services.GetService(); #if ORIGAM_CLIENT deployment.CanUpdate(_schema.ActiveExtension);