What's New in Version 4.0: Key Features

Estimated reading time: 5 minutes

The major new features on Monarch Base 4.0 are:

Other features include:

  • Change in the way keyboard errors are displayed; instead of a pop-up, they are being sent to the DdsMessagePanel location. The DdsMessagePanel should include a class="dds-message-panel"

Version 4.0 of ASNA.QSys.Expo is not backwards compatible with versions 3.x. There are a few modifications for upgrading websites using Monarch Base 3.x to use version 4.0.

Support for .NET 6.0 & 7.0

Monarch Base 4.0 is packaged with assemblies multitargeted for .NET 5.0 and .NET 6.0. The 6.0 versions can also be used with .NET 7.0.

This multitargeting support is temporary and the .NET 5.0 assemblies will be eliminated at the end of spring 2023.

Running Multiple Jobs from a Single Browser

To add support to your application for running multiple jobs, please read these articles:

Upgrading Websites from 3.x

Before upgrading the Monarch Base NuGet packages to version 4.0, please read this section.

The following classes had some breaking changes:

  • The Command class had some method signature changes.
  • The SessionStorage class lost several properties and methods.
  • The new class JobSession was added to replace or enhance the functionality of the previous two classes.

Session Object

There are also some values that version 3.0 used to save in the Session object that have been transferred to the JobSession class. Of particular note is the value that used to be saved with key "ASNA_MonarchCommandParm". See the SessionStorage Class section below.

Command Class

These signatures changed:

  • Constructor - The constructor requires now a JobHandle. To obtain a JobHandle for an existing job, you can use the new static method GetRequestJobHandle. You can also use the new factory method GetCommandFromRequest in lieu of using the constructor.
  • StartJob - The StartJob method now returns the JobHandle of the started job.

There is a new method to CommitJobSession.

SessionStorage Class

Some values that version 3.0 used to save in the Session object have been transferred to the JobSession class.

The SessionStorage class provides an ordered way of getting and setting values in the ASP.NET Core ISession collection. Since the session storage is shared by all the Tabs on a user browser, the session is not a convenient place to store job related values. Monarch Base 4.0 provides the new class JobSession to facilitate the storage of job related items. For this reason several properties and methods were lost from the SessionStorage class and ‘transferred’ to the JobSession class.

SessionStorage lost these properties:

  • JobNumber - Use the Command.GetRequestJobHandle to find a JobHandle instead. For sites configured to run with a single job per browser, you can use the new SingleJobNumber property.
  • EnabledKeys
  • OutsidePages
  • AbEndMessage
  • AbEndStack

The following methods were removed:

  • SetCmdParm
  • SetSessionBytes
  • GetSessionBytes

Additionally, the value that used to be saved with the key "ASNA_MonarchCommandParm" has been removed and transferred to the JobSession.CommandParm property.

Your Non-Display File Pages

Any usage of the methods or properties mentioned above will required changes to your non-display file pages. It is useful to go thru the description on Calling a Program from a Non-DisplayFile Page where you will see the use JobSession class being used.

Note that you may need to call the Command.CommitJobSession if you modify the JobSession and do not Command.Call a program as the last operation of your Non-Display File page action. Call commits the JobSession prior to giving control to the called program.

ASNA Provided Pages

The changes above will affect the following Razor Pages in the Monarch folder:

  • Diagnose
  • EoJ
  • ExpiredSession

Diagnose Page

The OnGet() method of Diagnose.cshtml.cs should read like this:

        public void OnGet()
        {
            AbEndMessage = Request.Query.ContainsKey("AbEndMessage") ? Request.Query["AbEndMessage"] : "";
            AbEndMessage = AbEndMessage.Replace("\\n", "\n");
            AbEndMessage = AbEndMessage.Replace("\\r", "\r");

            AbEndStack = Request.Query.ContainsKey("AbEndStack") ? Request.Query["AbEndStack"] : "";
            AbEndStack = AbEndStack.Replace("\\n", "\n");
            AbEndStack = AbEndStack.Replace("\\r", "\r");
        }

EoJ Page

The OnGet method of EoJ.csctml.cs should read like this:

        public void OnGet()
        {
            HttpContext.Session.Remove("ASNA_SingleJobNumber");
        }

For websites supporting multiple jobs per browser, the OnGet can be removed.

ExpiredSession Page

The OnGet method in version 3.0 of ExpiredSession.cshtml.cs may had been clearing the session. This should be removed.

AbEnd view

A new view AbEnd should be added to the Monarch folder with this content.

@model ASNA.QSys.Expo.Model.YellowPageModel
@{
}

<div style="padding:1em">
    <h1>Abnormal Termination</h1>
    <br />
    <em>There has been an abnormal termination of the program.</em>

    <p><strong>Exception</strong></p>
    <pre style="background-color:yellow;">@ViewData["ASNA_AbEndMessage"]</pre>

    <p><strong>StackTrace</strong></p>
    <pre style="font-size: smaller">@ViewData["ASNA_AbEndStack"]</pre>
</div>