This project uses .NET Core Web API to provide a RESTful web service.
Configuring .NET Core Web API Services
To configure a .NET Core Web API project, refer to Setting .NET Core Web API Properties and Security Settings for an Application.
Adding the RESTful Web Service Project
In Solution Explorer, right-click the solution node, click Add, and select New Project....
In the Create a new project dialog box, do the following:
Notes:
Select C# or All Languages from the Language list.
Select Windows or All Platforms from the Platform list.
The ePortal templates are not displayed if other values are selected.
Select ePortal Presentation from the Project Type list.
The ePortal Presentation templates are displayed.
Do one of the following to select the template:
From the templates list, select ASP.NET Core Web API Application, and then click Next.
Enter ASP.NET Core Web API Application in the search option, select the template from the search result, and then click Next.
Optionally, change the project name, and location, and then click Create.
In Solution Explorer, right-click the new presentation project name and select Add Unisys ePortal Data Source Reference.
The Add Unisys ePortal Data Source Reference Dialog box appears. For more information, refer to Adding Unisys ePortal Data Source Reference.
Select the desired data source project and click OK.
Click Build and select Build Solution.
Configure the ApplicationInfo.json file. For more info, refer to Updating the Configuration Files (Optional).
Optionally, if you want to customize the Web API Core project, update the Unisys Data Source Web API Core Controller.cs.t4.json configuration file. For more information, see "Customizing T4 Templates and the Configuration File".
Complete the dialog as described in the help reference.
Notes:
To use the 2.0 Open API schema, set the OpenAPISpecification_SerializeAsV2 property to True. By default, ePortal generates 3.0 Open API schema.
For a .NET Core Web API presentation project, the UTS data source connector is not supported.
Configuring Reuse Connections for the AB Suite/EAE Connector
ePortal developer enables you to reuse the AB Suite/EAE host connections in a .NET Core Web API application. You can set the reuse connections as required for an application.
When a connection is required and there are no connections available in the connection pool, a new connection is created. It remains attached to the client session until a request is made to close the host session.
When a client session requests a new connection, it uses the following matching properties to verify if an applicable connection is available in the connection pool. If the properties match an existing connection, then it is allocated to the requesting client session.
Host Name
Port Number
Secure Connection
View Name
Reuse connection reduces the resource usage on both ePortal server and back-end host. It also eliminates the time taken to establish a connection to the host application.
To support the reuse connection capability with AB Suite/EAE connections, the following three properties are available in the JSON configuration file of the .NET Core WebAPI project:
The configuration file name uses the following format:
<Data Source name>.json
For example, SampleDataSource.json
Property | Description |
---|---|
ReuseConnections | If set to True, allows a stateless application to reuse a connection from the connection pool when the matching properties of a connection is met. Requests are made to the same station ID and when not in use, the connections are pooled for the time specified by the PoolTimer value. Note: By default, ReuseConnections is set to False. |
PoolTimer | The amount of time in minutes that an unused physical connection remains open in the connection pool, if ReuseConnections is set to true. The default value is 5 minutes. |
FireupIspecForPooling | Allows you to control the Ispec that should be returned when a pooled connection is reused. |
Migrating the ePortal ASP.NET Core Web API Projects
To migrate the existing ePortal ASP.NET Core Web API projects to the later version of ePortal Developer, refer to Updating NuGet Packages.
Updating NuGet Packages updates all the Nuget packages and the Unisys Data Source Web API Core Controller.cs.t4 file of the ePortal ASP.NET Core Web API project.
Customizing T4 Templates and the Configuration File
To customize your ePortal ASP.NET Core Web API project scaffolding, perform the following steps:
Create a copy of the T4 Template file named “Unisys Data Source Web API Core Controller.cs.t4” and the configuration file named “Unisys Data Source Web API Core Controller.cs.t4.json” in the following location:
<Project Folder>\CoreAPI\CodeTemplates\AddController
Modify the copied T4 Template and configuration file with the custom changes and save it in the same location.
To generate the Web API controller based on the custom T4 template, select the custom version T4 template in the Scaffold Web API Core Controller for ePortal Data Source dialog box.
Note: If you install a newer version of ePortal Developer that contains changes to the standard T4 template, then you have to apply those changes to your custom template. Custom template files are not updated automatically.
Testing
Refer to Testing a .NET Core Web API RESTful Web Service Application.
Next Step
Refer to Staging a .NET Core Application.