Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Architect throw exception when is Disconnected. #216

Merged
merged 3 commits into from Feb 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion backend/Origam.Services/IParameterService.cs
Expand Up @@ -60,5 +60,6 @@ public interface IParameterService : IWorkbenchService
decimal floatValue, decimal currencyValue, object dateValue, Guid? overridenProfileId);
void RefreshParameters();
Guid ResolveLanguageId(String cultureString);
}
void PrepareParameters();
}
}
2 changes: 1 addition & 1 deletion backend/Origam.Workbench.Services/ParameterService.cs
Expand Up @@ -577,7 +577,7 @@ private Hashtable FeatureList
}
}

private void PrepareParameters()
public void PrepareParameters()
{
lock(_constantsById)
{
Expand Down
23 changes: 11 additions & 12 deletions backend/OrigamArchitect/ArchitectWorkbench.cs
Expand Up @@ -2151,6 +2151,8 @@ private void _schema_SchemaLoaded(object sender, EventArgs e)
OrigamEngine.InitializeSchemaItemProviders(_schema);
IDeploymentService deployment
= ServiceManager.Services.GetService<IDeploymentService>();
IParameterService parameterService
= ServiceManager.Services.GetService<IParameterService>();

#if ORIGAM_CLIENT
deployment.CanUpdate(_schema.ActiveExtension);
Expand Down Expand Up @@ -2181,11 +2183,12 @@ IDeploymentService deployment
}
}
#else
ApplicationDataDisconnectedMode
ApplicationDataDisconnectedMode
= !TestConnectionToApplicationDataDatabase();
if (ApplicationDataDisconnectedMode)
if (ApplicationDataDisconnectedMode)
{
UpdateTitle();
parameterService.PrepareParameters();
UpdateTitle();
return;
}
bool isEmpty = deployment.IsEmptyDatabase();
Expand Down Expand Up @@ -2218,24 +2221,20 @@ IDeploymentService deployment
}

#endif
IParameterService parameterService =
ServiceManager.Services.GetService(typeof(IParameterService)) as IParameterService;

try
{
parameterService.RefreshParameters();
}
catch(Exception ex)
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)
#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,
Expand Down