Use Case 6: Customizing application logic of SyteLine IDO hand-coded method that used Composition Root
Scope:Logic exists only in .NET. Similar scenarios exist as EXTGEN.
Category:Full Code
Tier:OB
TotalSalesYTD.home is used for this simple example, with the customization intended to replace the amount and caption for the bar chart with a hard-coded amount value and text value, respectively.
Note: This form may be hidden, in which case, the developer would
need to Show All Forms in Forms List to proceed with this
example exercise.
This use case describes a change that minimizes the amount of code of which to take ownership. It is not required to create a custom entry point.
The extension class code for this example customization resides within <release>_SL10SolutionSDK.zip, beginning with the 2024.04 release.
- In SyteLine, Total Sales YTD will show a calculated amount with an X axis label of Amount.
- Extension Class Code
- The base SyteLine interface is in IHomepage_TotalSales_DataTable.cs. This is a public interface.
- The base SyteLine class that implements the base SyteLine interface is in Homepage_TotalSales_DataTable.cs.
- The sample customization is in
CustomCode\CustomizationWithoutEntryPoint.
- The custom project is UE_CustomizationCode.
- The custom class that implements the base SyteLine interface that will replace the base SyteLine class is in UE_Homepage_TotalSales.cs.
- Build the UE_CustomizationCode project.
- Within SyteLine:
- Upload custom UE_CustomizationCode.dll into the IDO Custom Assemblies form. Cloud naming convention shown for Assembly Name (ue_CustomizationCode) mapped to C# UE_CustomizationCode.dll.
- Set up the registration of the custom code.
- Create new IDO Custom Assembly on the IDO Custom
Assemblies form.
- Assembly Name: ue_MyExtensions
- Assembly Type: Build From Source
- Extend And Replace: CSI.Extensions
- Save
- Select Source Code which opens
the IDO Extension Class Source Code
form.
- Specify a filename for your IDO Extension Class Source
- Replace the code within the edit block with the
following code which is copied from Source Code
for CSI.Extensions. This is where the registration
of the custom service will be
specified.
using System; using System.Collections.Generic; // Please do not modify the namespace. // Please ensure the class name is Services. namespace CSI.Extensions { /// <summary> /// The code in this class Services is to register services with related implementations. /// </summary> public partial class Services { [CSI.CSIExtension] public IEnumerable<(Type serviceType, Type implementationType)> SytelineSampleServicesWithAnyName { get { // Please register your services with related implementations. See example below. // yield return (typeof(CSI.Logistics.Customer.IHomepage_TotalSales_DataTable), typeof(UE_CustomizationCode.UE_Homepage_TotalSales)); yield break; } } } }
- Replace “SytelineSampleServicesWithAnyName” with your own name such as MyService
- Uncomment the following line which will result in the
registration of the custom implementation
UE_CustomizationCode.UE_Homepage_TotalSales for the base
SyteLine interface
CSI.Logistics.Customer.IHomepage_TotalSales_DataTable)
- yield return (typeof(CSI.Logistics.Customer.IHomepage_TotalSales_DataTable), typeof(UE_CustomizationCode.UE_Homepage_TotalSales));
- Save.
- Return to the IDO Custom Assemblies form.
- It is necessary to have references to every dll used in the
registrations list, whether it is base SyteLine code or custom code.
- Add UE_CustomizationCode to References.
- This is the dll that contains the custom code.
- If the reference to the dll containing the base SyteLine code is not already included, it will also need to be added to the References of the build-from-source custom assembly that extends and replaces the base SyteLine CSI.Extensions custom assembly.
- Add UE_CustomizationCode to References.
- Save.
- Select Build Assembly. A message displays that the assembly has compiled and updated successfully.
- Unload IDO Cache (See Documentation).
- Open the Total Sales YTD form and note the
Fixed Value 1K as well as the x axis label: Fixed Value from
UE_Homepage_TotalSales.
- Create new IDO Custom Assembly on the IDO Custom
Assemblies form.