.NET Framework 2.0 design considerations and expected behavior

  • 16 February 2021
  • 0 replies
  • 11 views

Userlevel 3
Badge +8
 

.NET Framework 2.0 design considerations and expected behavior

KB000152

PRODUCT
K2.net 2003
TAGS
Deployment
LEGACY/ARCHIVED CONTENT
This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.

This article discusses the expected behavior of .NET 2.0 assemblies referenced in K2.net 2003. This article applies to assemblies referenced from the GAC and the file system.

 

Introduction

Important: The information shared in this article is strictly related to K2.net 2003 SP4(3.6262.1.0)

This article discusses the expected behavior of .NET 2.0 assemblies when referenced in K2.net 2003 and also applies to assemblies referenced from the GAC and the file system.


The results will require a K2.net Server restart which is not always advantageous in production environments. This can however be avoided by implementing the recommendations in this article. The recommendations would therefore make the transition to using .NET 2 references in K2.net 2003 Studio more effective.

Part 1: Demonstration

The following example is an illustration of the outcome when using .NET 2.0 assemblies as a reference in K2.net 2003.

1)  Create the following class in VS .NET 2005 as illustrated. The purpose of the assembly is to output a text message to the K2.net Server console to test whether the correct version of the assembly was loaded with the process instance.
 

 

Public Class Class1
 Public Sub CallFromK2(ByVal procFolio As String)
   Console.WriteLine("")
   Console.WriteLine("################# START Test #################")
   Console.WriteLine(procFolio & " - .NET 2 Assembly Version: 1.0.0.0")
   Console.WriteLine("################## END Test ##################")
   Console.WriteLine("")
 End Sub
End Class

 

 
2)  In K2.net 2003 Studio, create a process and reference the assembly illustrated above. Add a K2.net Server Event and edit the code as illustrated below:
 

 

Sub Main(ByVal K2 As ServerEventContext)
 K2.Synchronous = True
   Dim oObject As New SampleClass.Class1
   oObject.CallFromK2(K2.ProcessInstance.folio)
End Sub

 

 
3)  Start K2.net 2003 Server in console mode for testing purposes
4)  Export the process to the K2.net Server and set the necessary permissions on the process
5)  Create a new process instance, the result of the assembly call is illustrated in the image below:
  
 
6)  Update the assembly in VS .NET as illustrated. The code change made to the assembly included an additional output to the console to test the conditions under which the new assembly will be loaded.
 

 

Public Class Class1
  Public Sub CallFromK2(ByVal procFolio As String)
   Console.WriteLine("")
   Console.WriteLine("################# START Test #################")
   Console.WriteLine(procFolio & " - .NET 2 Assembly Version: 1.0.0.0")
   Console.WriteLine("Make some changes in the assembly")
   Console.WriteLine("################## END Test ##################")
   Console.WriteLine("")
 End Sub
End Class

 

 
7)  Recompile the assembly and update the reference in K2.net Studio. Note: Remove the existing reference and add the reference again
😎  Export the process to the K2.net Server
9)  Create a new process instance, the result of the assembly call is illustrated in the image below:
 
  
 
Note: The updated version of the assembly was not used during the execution of the process instance.
 
10)  Restart the K2.net Server and create a new process instance, the result of the assembly call is illustrated in the image below:

  

 
Note: Restart the K2.net Server and the correct assembly will be loaded.
 
Important: All versions of the process definition will use the current version of the assembly; this may cause compatibility issues between the older versions of the process.
 
Part 2: Best Practices
The following section discusses the ideal way of dealing with references in K2.net and should be used as a guideline / best practice during development and testing.
1)  In VS .NET open the class created in the previous section and update the assembly version used in the "CallFromK2" method from "1.0.0.0" to "1.0.0.1".
 

 

 

Public Class Class1
  Public Sub CallFromK2(ByVal procFolio As String)
   Console.WriteLine("")
   Console.WriteLine("################# START Test #################")
   Console.WriteLine(procFolio & " - .NET 2 Assembly Version: 1.0.0.1")
   Console.WriteLine("Make some changes in the assembly")
   Console.WriteLine("################## END Test ##################")
   Console.WriteLine("")
 End Sub
End Class

 

 
2)  Open the "AssemblyInfo.vb" or "AssemblyInfo.cs" file and update the version of the assembly to "1.0.0.1".
3)  Save and recompile the assembly then update the reference in K2.net Studio.
 
Note: Remove the existing reference and add the reference again.
 
4)  Export the process to the K2.net Server
5)  Create a new process instance, the result of the assembly call is illustrated in the image below:
 
  
 
Note: The correct version of the assembly is loaded without having to restart the K2.net Server. To insure that the latest version of the assembly is used, recompile the assembly with an updated version number.
 
Part 3: Demonstration on testing older process versions
This section demonstrates how to test older versions of the same process to ensure that the correct assembly is used with the selected version of the process
 
1)  In K2.net 2003 Service Manager, change the default process version to the version that made use of version "1.0.0.0" of the assembly.
2)  Create a new process instance and the result of the assembly call is illustrated in the image below:
  
 
Note: The correct version of the assembly is used in conjunction with the older process definition.
 
3)  Change the default process version back to the latest one and create a new process instance, the result of the assembly call is illustrated in the image below:
 

  

 
Summary:
As demonstrated above, the current assembly with an updated version number will effectively enable the K2.net Server to run current and older versions of the same process, without the need to restart the K2.net Server when .NET 2 assemblies are reference in K2.net 2003.

 


0 replies

Be the first to reply!

Reply