Runtime, Code Generation and Manual Rules

Modified on Fri, 22 Mar 2024 at 02:29 PM

The Core contains the code generators generating the code to execute the migration. In addition, the Core provides the base class libraries supporting the generated code.

Apart from supporting the generated code, the base class libraries also contain interface functionality that enables the Core to discover the generated code and call it to perform the different steps in the migration.

Based on the mapping the generated code automatically handles by far most of the migration logic. 

In some cases, the mapping contains the information describing the interface to a manual rule that will be called by the generated engine. In these cases, the generated code will contain a default implementation of the rule. This default implementation will report an error event to the Portal, that this rule has not been implemented. 

Visual Studio 

Visual Studio is the state-of-the-art Integrated Development Environment (IDE) provided by Microsoft to write and maintain .NET program code. 

In practice, the generated code for a given mapping resides inside a folder in a normal Visual Studio c# class library project. 

Manual rules are implemented in this Visual Studio project by overriding a virtual method provided in the generated code. This overriding method is specified manually in a separate file (using the partial class mechanism in c#) protecting the manual implementation from being overwritten by the code generator. This is a simple, well-known, mainline mechanism and the implementation of manual rules is indeed very straightforward.

The best practice workflow when working with a combination of the mapping from the Studio, the code generator, Visual Studio and finally the Runtime is quite simple and supported by extensions to Visual Studio delivered as part of hopp:

  • Studio: The latest version of the mapping is retrieved from the backing repository.  The mapping is then validated and published to a file
  • Code generator: The code generator is activated specifying the published file as input and the correct Visual Studio folder as output. The code generator will generate the code and place all generated files in the specified folder, where they become a part of the Visual Studio project
  • Visual Studio: If necessary, manual rules are modified/implemented. Then the entire Visual Studio class library project is built and deployed to a location accessible by the Director
  • Runtime: The Runtime is reset, causing it to load the new version of the class library containing the latest generated code and manual rule implementations 

It is a key quality of hopp that working through the points above is very fast – normally a few minutes. 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article