<<

DOCUMENT TYPE | Title Here

.NET Assemblies in Gupta TD 6

OpenText Gupta Team Developer

Abstract

Microsoft .NET is a Framework supporting multiple language allowing those languages to exchange code and can be referred as interoperability. An application that uses the .NET Framework, a large library of class will be able to consume an amazing collection of features through .NET assemblies. Assemblies are collections of compiled objects directly deployable supporting versioning, security and much more.

WHITEPAPER | .NET Assemblies in Gupta TD 6

Table of Contents Overview ...... 3

What is a .NET ? ...... 3

Building blocks ...... 3

.NET runtime Versus OpenText Gupta Team Developer runtime...... 4

Advantage using .NET assemblies ...... 4

.NET Assemblies features ...... 4

Global Assembly cache ...... 4

Location of the GAC ...... 5

.NET Framework command line tools to manage the GAC ...... 6

Strong name and Registration process ...... 6

Strong name key generation...... 7

Linking keys to .NET assemblies ...... 7

Installing the assembly on the GAC ...... 7

Overview Consuming .NET assemblies in OpenText GuptaTeam Developer .. 8

.NET explorer Wizard overview ...... 8

.NET explorer generated interface ...... 10

.NET generated interface and dependencies ...... 10

Consuming .NET core features ...... 11

Win32 SDK versus .NET Base class library (BLC) ...... 11

File Information Sample ...... 11

.NET assemblies versus Opentext Gupta Team Developer external calls .. 16

Constructor, Collection, enumeration, properties ...... 17

A word about .NET security and OpenText Gupta Team Developer ...... 21

Public access modifier and the __exported pragma ...... 21

.NET exceptions versus OpenText Gupta Team Developer error handling .... 23

Exceptions in OpenText Gupta Team Developer .NET target consuming assemblies ...... 23

Current limitations ...... 23

Conclusion ...... 24

About OpenText ...... 25

O P E N T E X T G U P T A T E A M D E V E L O P E R 2 WHITEPAPER | .NET Assemblies in Gupta TD 6

Overview

OpenText Gupta Team Developer now supports .NET! This unleashes tremendous power and flexibility, allowing you to create rich GUI application and more:

You can now create a WPF application directly in Team Developer using SAL. See:

 Creating a .Net WPF application from scratch

You can also consume WPF controls. See:

 WPF Container and Controls in TD 6.0

You can create specific SAL .NET Libraries, assemblies allowing you to export class and GUI components to other .NET Team Developer applications:

 Migrating apps which use Dynalibs

Finally, you can create and consume non visual .NET assemblies in Team Developer 6.0 allowing you to use the richness of the .Net Framework library. Use custom compiled assemblies produced with different language such as VB, C# and of course Team Developer 6.0 allowing you to share your work to the growing .NET community.

This is what this document will cover. What is a .NET assembly?

It is the building blocks of .NET Framework applications. A .NET assembly is an output unit of code that a specialized runtime (CLR) executes in a managed way.

This might be vague to you, so let’s try to make some analogies to what we know well and then get to the details and differences:

Building blocks

In a very basic way you could compare it to the building blocks of a Gupta Team Developer application: Were you might call External function to a DLL to consume certain features of the Windows API. Sal API calls to the Gupta Team Developer runtime for the User Interface and SQL access and so on. Then you might eventually create Gupta Team Developer modules using Dynalibs or COM object to encapsulate your business logic for sharing and re-use at a binary level as opposed to source level when using application libraries APLs.

The common point of all this is that Gupta Team Developer .EXE application as well as Dynalibs and COM Objects contains code written in SAL. This code gets interpreted and executed by the Team Developer Runtime CDLLIxx.DLL. In a word the Gupta Team Developer runtime interprets and manages the execution of your Gupta Team developer application.

When you are building a .NET Framework application .EXE or modules .DLL, with C# or Team Developer the output language contained in the .NET assembly is called the Common Intermediate Language (CIL).

O P E N T E X T G U P T A T E A M D E V E L O P E R 3 WHITEPAPER | .NET Assemblies in Gupta TD 6

It gets compiled into the machine language at run-time by the (CLR) just-in- time- (JIT), to finally run in a virtual machine. The CLR is an execution engine and is managing at this point your .NET application or assemblies, i.e.: Garbage collection.

.NET runtime Versus OpenText Gupta Team Developer runtime

The important differences here with a Win32 Team Developer application .EXE or APD/COM apart the intermediate language (IL) versus SAL is the CLR and the JIT compiler. As you understood, you no longer use the Team Developer runtime but use the .NET one when doing a Team Developer WPF application or class.

The CRL/JIT will compile dynamically CIL to the maximizing it for performance by caching compiled code. The virtual machine being plate-form agnostic allows in principle the execution of your code on any plate-form supporting the .NET framework.

Advantage using .NET assemblies

The advantage beyond the Virtual machine is that .NET assemblies as well as .NET application since they are also assemblies should perform faster compared to Team Developer runtime execution thanks to the JIT compiler. Other advantage is that Operating system ships with the .NET framework already deployed, i.e.: Windows 7 and the .NET framework 3.5 hence ease of deployment.

.NET Assemblies features

The comparison really stops here even compared to COM that deals also about versioning. With .NET you will enter a new world full of rich features, beyond the programming tasks and the runtime aspects describe above as .NET assemblies supports:

 Security defined through policies  Name spaces and scope  Reference and dependencies through meta-data  Versioning through manifest  Deployment aspect  Side-by-side execution for multiple versions of assemblies on the same machine.

As stated assemblies are the building blocks of .NET Framework application hence the topic is vast, please for detailed information consult: http://msdn.microsoft.com/en-us/library/k3677y81%28v=VS.71%29.aspx

For the support of some of these feature mentioned previously, the .NET Framework manages a repository of assemblies:

O P E N T E X T G U P T A T E A M D E V E L O P E R 4 WHITEPAPER | .NET Assemblies in Gupta TD 6

The Global Assembly Cache or GAC is the global machine .NET assembly cache for the Common Language Runtime (CLR). It is a central repository for sharing libraries that supports Versioning, side by side execution in a word allows for better code sharing and functionalities without common issues found in simple DLL interface: conflict of versions when there are multiple DLL of the same name on the machine. .NET achieves this using strong name for assemblies. In some way similar to COM object and its registration process in the registry.

Location of the GAC

The repository is generally located in %windir%\assembly\ directory but can be relocated if needed.

System.Xml in the machine GAC viewed by the explorer

As you can see this does not look like a classic file system viewed from the explorer. If you right click on an assembly name you can’t delete it, but you can un-install it or watch its property. You can also install a signed strong name assembly directly in the repository using drag and drop.

Trying to drag and drop a non-signed assembly to the GAC in order to install it results in:

O P E N T E X T G U P T A T E A M D E V E L O P E R 5 WHITEPAPER | .NET Assemblies in Gupta TD 6

.NET Framework command line tools to manage the GAC

Additionally the .NET framework provides command line tools to interact with the GAC: gacutil.exe /l will list all of the assemblies.

You can also give the name of the assembly and see its property:

gacutil.exe /l System.Xml Microsoft (R) .NET Global Assembly Cache Utility. Version 3.5.30729.1 Copyright (c) Microsoft Corporation. All rights reserved.

The Global Assembly Cache contains the following assemblies:

System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL

The GAC is important to the .NET framework not only does it support versioning, but security and more. Strong name and Registration process

In the COM world, to expose a DLL/EXE as a COM component you register it in the registry using its Global Unique ID (GUID). The .NET framework uses a different but quite similar way to register assemblies. Before being installed on the GAC an assembly must be given a strong name by generating a key:

O P E N T E X T G U P T A T E A M D E V E L O P E R 6 WHITEPAPER | .NET Assemblies in Gupta TD 6

Strong name key generation

The .NET framework provides a command line tool for generating such key:

sn -k MyClassLibrary.snk

Microsoft (R) .NET Framework Strong Name Utility Version 3.5.30729.1 Copyright (c) Microsoft Corporation. All rights reserved.

Key pair written to MyClassLibray.snk

Linking keys to .NET assemblies

Once you have the key generated you must link that key to the assembly you created with your development tool to be able to register it on the GAC.

Installing the assembly on the GAC

gacutil /i MyClassLibrary.dll Microsoft (R) .NET Global Assembly Cache Utility. Version 3.5.30729.1 Copyright (c) Microsoft Corporation. All rights reserved.

Assembly successfully added to the cache

Assembly showing in the GAC registered either via gacutil /i or by drag and drop.

Un-installation can be done by simply-uninstall the assembly (right click) or use gacutil /u to un-install it…

O P E N T E X T G U P T A T E A M D E V E L O P E R 7 WHITEPAPER | .NET Assemblies in Gupta TD 6

Overview Consuming .NET assemblies in OpenText Gupta Team Developer

Consuming .NET assemblies in Gupta Team Developer involves a similar process as to consume ActiveX/COM object and Web Services. As you might already know the process is to use a Wizard:

 The ActiveX explorer for Visual ActiveX and Non visual COM object  Web Service Wizard as it stands for Web Services.

For .NET assemblies the new .NET assembly Wizard provides the same means:

 Explore the available assemblies name space  Select the desired classes  Finally generate an interface for Gupta Team Developer as an APL to allow the consumption of object with all its aspects: Method invocation, get and set of properties, parameters serialized/de-serialized to Team Developer Data types etc.

.NET explorer Wizard overview

The .NET explorer wizard allows you to select two groups of assemblies:

 GAC Assemblies from the Global Assembly cache Globally deployed “registered” assembly from the machine

O P E N T E X T G U P T A T E A M D E V E L O P E R 8 WHITEPAPER | .NET Assemblies in Gupta TD 6

 Assembly File that are custom assembly file not in the GAC. The only difference with the first is that these are simply not in the GAC as discussed previously and must be selected using a file path in the .NET explorer. There are no other differences at this point.

System.Xml from the GAC selection in Team Developer

In the Select Assembly screen you can only select one assembly at the time. Let’s select System.Xml assembly as an example. This assembly has many class but we will select only the System.Xml.XmlDocument class. You can multi-select class(s) as suite your needs.

System.Xml.XmlDocument selection in TD VS 2010 object browser showing the XML Document class

O P E N T E X T G U P T A T E A M D E V E L O P E R 9 WHITEPAPER | .NET Assemblies in Gupta TD 6

.NET explorer generated interface

Finally, the .NET explorer will have generated a Gupta Team Developer APL and AXL interface in the specified Output path using the name of the selected assembly.

AXL file are new to us: You can actually think of the AXL file as external declaration to the assembly as in some ways external function is to DLL. There is nothing really that would prevent you adding methods in this file by yourself.

The .AXL file is an XLM file and used only when you target for a .NET WPF application to allow native .NET assemblies consumption. Under the hood Gupta Team Developer will consume the assembly through the AXL definitions actually bypassing the proxy generated by the .NET explorer. If your target application is a WIN32 application, then the AXL is not used and only the generated proxy is used, to invoke the assembly and its and underlying Generic Assembly Interface (GAIL) API.

In either case a WIN32 or a WPF target application, the generated proxy to your .NET assembly, is also used to support your development effort in consuming the assembly. It allows you to explore classes, enumeration and so on as you would usually be using Gupta Team Developer and the Active coding assistant as an example. On this respect there is no really difference in the way you program a .COM or ActiveX client or a .NET assembly in Gupta Team Developer. You simply declare a variable representing your class, instantiate it, then call methods use properties, drilling in your .COM object or assembly.

.NET generated interface and dependencies

As opposed to the ActiveX wizard, if a class dependent to other .NET class the wizard will also import them automatically. Here you can see that .NET explorer pulled in additional dependent class. An APL interface produced by .NET explorer should always compile without error. This is also the case with ActiveX wizard generated APL interface, with the difference that you might need to pull in additional codes.

Note: Currently at the time of this writing, the .NET explorer can only work with one assembly at the time, but can use multiple classes from the assembly. Also a single file name based from the assembly name selected will be used for the generation of the interface. If a file already exists and you like to consume

O P E N T E X T G U P T A T E A M D E V E L O P E R 10 WHITEPAPER | .NET Assemblies in Gupta TD 6

additional features, you need to select all what is needed before. This is because the generated files get overwritten and there is currently no merging of the added feature in the already generated APL/AXL file. Consuming .NET core features

As mentioned in the introduction, the .NET framework and its assemblies and class of objects will provide you unprecedented level of functionalities. Surely as a Gupta Team Developer programmer you have heaps of feature already available natively in Team Developer, but anyone knows that a relatively simple Gupta Team Developer application almost certainly uses external function calls for added features and possibly ActiveX control and COM automation.

Win32 SDK versus .NET Base class library (BLC)

All the core features that exist in the WIN32 world i.e.: kernel32.dll, user32.dll and all Microsoft shared DLL’s should be available as assemblies on the .NET framework. The difference is that they are not exposed to you in a simple DLL interface, but in an object oriented way, as managed code (more safe), by the .NET framework with all the added benefits to you. For this reason, they are in fact easier to consume than external function calls. The difficulty and challenges for the one migrating a Win32 application using many external function calls is the identification of the equivalent feature on the .NET side. That is the difficulty, the learning curve of .NET as there used to be a learning curve for WIN32, you know... This say Team Developer still support external function calls as long as window handle (HWND) and structure pointer (structPointer) are not in use.

So let’s take an example where a Gupta Team Developer application is requesting to check for File version information. This might be a needed task and Team Developer does not offer natively this functionality. Team Developer allows you to set version information to your application build but does not provide features to query them.

You might already know that this feature is implemented in Version.dll. You know then you can use its feature as an external function call declared in a Gupta Team Developer application. When using .NET you don’t need to know the DLL name that exposes the functionality, you just need to read about the .NET frame work and its Base Class Library (BCL). This learning task might be even easier than reading the WIN32 SKD API category. The BCL encapsulate many of the common functionalities through the System name space including the core functionalities needed by any .NET application. Many of the WIN32 feature from Kernel32.dll, user32.dll and so on should be found in the BCL.

Indeed the same functionality from Version.dll exists on the .NET framework exposed in System.Diagnostics.FileVersionInfo.

If you know about object oriented programming and ActiveX and COM client programming in Gupta Team Developer, then you should be at home here. So let’s see if this basic task of checking File Information through .NET assemblies is as obvious as it is using Win32.

File Information Sample

Let’s create a new application and make it a WPF Desktop type application

O P E N T E X T G U P T A T E A M D E V E L O P E R 11 WHITEPAPER | .NET Assemblies in Gupta TD 6

Next let’s use the .NET explorer Wizard and select the GAC assembly selecting the system name space assembly

Next searching for System.Diagnostic.FileVersionInfo and select it

O P E N T E X T G U P T A T E A M D E V E L O P E R 12 WHITEPAPER | .NET Assemblies in Gupta TD 6

When finishing the .Net explorer wizard had generated two files system.apl and system.axl as explained previously.

Now as we do for any Application Library in Gupta Team Developer let’s include the generated APL in our main application. Note that the APL is not automatically included in our current outline as it is the case with the ActiveX explorer.

O P E N T E X T G U P T A T E A M D E V E L O P E R 13 WHITEPAPER | .NET Assemblies in Gupta TD 6

The generated interface, the “proxy” to our System.Diagnostic.FileVersionInfo should talk to you especially if you already used that function in WIN32 and chances are that you no longer need to read further on this sample as it is so. But this is a white paper and we need to prove some points here.

Notice we have a functional class System_Diagnostics_FileVersionInfo that was generated by the .NET explorer and you can imagine that the first task is to declare an instance of it, for example in a form.

It is not because you just declared an instance of a class that you can go-head and make calls to its member methods. Like COM objects or even Web Services you need to create the object so that it actually “lives” in memory.

O P E N T E X T G U P T A T E A M D E V E L O P E R 14 WHITEPAPER | .NET Assemblies in Gupta TD 6

Looking at the code generated by the .NET explorer something looks quite obvious in the Outline internal function:

This something is simply the constructor that allows you to create or get an instance of an object to associate with your instance variable. Here the method System_Diagnostics_FileVersion_GetVersionInfo() will return the FileVersionInfo object initialized and ready to use.

Note: As you can see the constructor is not implemented in our object, usually it is, we will see this in the next example. This is common in .NET when the designer does intend for the users to create the instances directly which is the case for FileVersionInfo. You get an instance of the object by calling a static method. All static .NET assembly function is exposed in the Internal Functions section, so they can be called like a global function.

At this point it is a simple matter to actually make the call and get the FileInFormation by querying its read only properties:

O P E N T E X T G U P T A T E A M D E V E L O P E R 15 WHITEPAPER | .NET Assemblies in Gupta TD 6

And finally get our results:

As you can see this example is very simple, it proves non-the-less the following points:

 It is easier to find core functionalities on .NET through the .NET documentation and the BCL than it is on WIN32 consulting only the SDK API reference. You can also explore functionalities with the many available tools.  Once the functionality has been found, it is easier to see the big picture of it thanks to .NET explorer through the objects it exposes rather than a simple API interface as it is done with external function calls which by the way you have to declare properly. Hence extra work and error prone.  It is safer than external function call because you are using managed code from the .NET CLR and nowhere you allocate memory or manipulate a complex structure. Memory allocation, structure manipulation is needed in the Version.dll interface when using win32.

.NET assemblies versus OpenText Gupta Team Developer external calls

Which one do you prefer?

Doing the same in WIN32 implies you to declare properly the external call, to use C structure, to extract them properly from a string buffer. Migration of these sorts of calls from ANSI to UNICODE is more complex than just rewrite it using .NET.

Some people avoid the use of the Gupta Team Developer CSTRUCT interface for good reasons by writing custom DLLs. It is error prone to manipulate a string buffer holding a structure in Gupta Team

O P E N T E X T G U P T A T E A M D E V E L O P E R 16 WHITEPAPER | .NET Assemblies in Gupta TD 6

Developer using CSTRUCT.APL … This is fine but that is an extra component to deploy in your application.

Constructor, Collection, enumeration, properties

Let’s continue our walk through consuming .NET assemblies in Gupta Team Developer using something a bit more complex. Here we show how objects are constructed and used as well as showing the uses of enumerations and collections.

This sample is simply a rewrite of the C# sample from the link bellow ported to Team Developer http://www.codeproject.com/KB/dotnet/perfcounter.aspx

It allows an application to monitor its performance in key places using a standard and proven ways; the Performance Monitor tool from the Windows Operating system.

The objects of interest are of the System.Diagnostics name spaces and classes used are:

System_Diagnostics_CounterCreationData System_Diagnostics_CounterCreationDataCollection System_Diagnostics_PerformanceCounter System_Diagnostics_PerformanceCounterCategory System_Diagnostics_PerformanceCounterCategoryType

O P E N T E X T G U P T A T E A M D E V E L O P E R 17 WHITEPAPER | .NET Assemblies in Gupta TD 6

Note: Above the classes are using underscore to separate the name space and its classes, this is the Gupta Team Developer notation as generated from the .NET explorer. As mentioned before it is important to select the right classes from the beginning. The .NET explorer does not currently supports merging of classes in an already generated .APL and .AXL interface.

Five classes are actually selected from the system assembly, two not showing in this view

When you are done with the wizard everything you need to implement Performance counters in your Gupta Team Developer application will be available:

Note: As .NET explorer knows the required dependencies from our list of selected classes, it will pull in what is needed. The goal is to generate the minimum useable.

The first action now for us is to create a Performance Counter Category on our server, please review http://www.codeproject.com/KB/dotnet/perfcounter.aspx as the article elaborate specifically on Performance counters and categories, touching base on the .NET visual studio Server explorer and Performance Monitor.

O P E N T E X T G U P T A T E A M D E V E L O P E R 18 WHITEPAPER | .NET Assemblies in Gupta TD 6

Here in this snapshot mind you that we already declared our instance of our object. This code snippet shows couple interesting new things:

Through a call to an internal function

System_Diagnostics_PerformanceCounterCategory_Exists() we check if the Performance Category already exist. If it does exist, we do not create it.

Constructor(s) We initialize the System_Diagnostics_CounterCreationDataCollection collection object using the CounterCreationData_Overload1( ) constructor member of the Gupta Team Developer functional class. Note that there might be one or more constructors. As we saw in the previous sample, object might also be initialized by an internal function. Here we don’t know much about Performance counter so we just mimic what the article about Performance counters show us in the C# code. So we use the _Overload1( ) constructor without any parameters. All what is marked as _OverloadN() where N is the number of methods with the same name but with different a parameter signature, hence procedure and constructor overloading.

Collection(s), setting properties We create four types of counters. This requires the creation and initialization of System_Diagnostics_CounterCreationData objects. This is done through the CounterCreationData_Overload1( ) constructor. At his point we go-head and set some properties in our counters. Finally, we Add the initialized counters object in our previously created collection object.

O P E N T E X T G U P T A T E A M D E V E L O P E R 19 WHITEPAPER | .NET Assemblies in Gupta TD 6

Enumeration(s) The final step of creation of a specific Performance counter for our Team Developer Application is to create our category “TD_SAMPLE” so that it is visible on the performance Monitor tool perfmon.msc, or Visual studio Server Browser. This is done through a call to a static function System_Diagnostics_PerformanceCounterCategory_Create_Overload4() exposed as a Gupta Team Developer internal function. The commented constructor call is because since the write up of the article from the Web, this constructor has been deprecated by Microsoft. Note that it also shows the uses of an enumeration SingleInstance in the third parameter

At this point executing this piece of code would create a “TD_SAMPLE” performance counter category with four types of counters as shown below in VS2010. Note that Perfmon.msc will expose only three counters as “average time per operation base” is based on “average time per operation”

The next step in our application is déjà-vu and does not need further explanations: We just use our counters by initializing four System_Diagnostics_PerformanceCounter objects; this is done in the action on SAM_Click of pbUseCategories. Then test our counters incrementing them by setting properties, see

O P E N T E X T G U P T A T E A M D E V E L O P E R 20 WHITEPAPER | .NET Assemblies in Gupta TD 6

pbTestCounters. At this point you have specific counters implemented in your application for you to monitor specific areas of your application

A word about .NET security and OpenText Gupta Team Developer

Security is important for any platform so goes for .NET. Some of the security features of .NET like access control to resources inherit from Object Orient programming language. Access modifier defined in a class allows encapsulation; the means of hiding some of the features required internally by the object but that a consumer of the object, depending its context, does not need to know about to actually use the object or part of the object depending its context. There are four access modifiers on .NET C# language but here we will talk briefly only about most commonly used access modifiers:

 Public: All classes, methods and properties defined as such are fully accessible.  Private: Methods and properties are not visible to the consumer outside the class. They are only accessible inside the class but not to a derived class.  Internal: Properties and methods are accessible to all code by any class within its containing assembly.

See the link bellow for additional details on access modifier and accessibility levels http://msdn.microsoft.com/en-us/library/wxh6fsc7%28VS.71%29.aspx

Public access modifier and the __exported pragma

You might already know that a Team Developer Application does not have the notion of accessibility levels to maybe one exception if the comparison stands:

O P E N T E X T G U P T A T E A M D E V E L O P E R 21 WHITEPAPER | .NET Assemblies in Gupta TD 6

Dynalibs and the !__Exported pragma that allows Global functions, Global Variables (No instance of a class), MDI, Top Level Windows and methods to be accessible/visible to the consumer of the Dynalib APD module.

Note that now a .NET class library target as well as the .NET Sal library target (the APD counterpart) allows exporting class.

Since Gupta Team Developer allows now to create .NET assemblies when targeting a Team Developer project to be a .NET class library. Access level will follow this rule:

Everything will be marked as internal except for those items marked with the “!__exported” in the code, which will be made public.

Currently ALL functional class, variable, instance variable will be visible to .NET.

What is accessible for a Team Developer that consumes the Tricycle class

O P E N T E X T G U P T A T E A M D E V E L O P E R 22 WHITEPAPER | .NET Assemblies in Gupta TD 6

.NET exceptions versus OpenText Gupta Team Developer error handling

Exceptions are special type of software or hardware events that might be triggered at any time in the execution flow of an application. They can be critical errors, warnings or just informational. In Team developer there is no really mechanism to handle exception as such as it is the case on .NET language.

The only events that can be trapped and can be seen as exceptions are SQL errors. They can be trapped / handled globally using On SAM_SqlError or locally in the context using When SqlError which resembles more or less the ways .NET handles exception. If there aren’t any SQLError handling in your Team Developer application, the runtime will attempt to handles them. All other possible errors in Team Developer apart SQL Error are not event driven, and error conditions are generally returned by the function itself as a Boolean value, hence the many SAL API using bOK as a return value. This leaves you with the responsibility to check them fully to attempt proper error handling in your Gupta Team Developer application. When using COM in Gupta Team Developer and we are faced to an un-handled error, the error is trapped as an automation error by the Team Developer runtime that handles it as a global non trappable by the user event. The only way to handle COM error is to disable the Gupta Team Developer runtime error handling using SalActiveXAutoErrorMode( false ). You would then check the return values of COM methods invoked. If it returns false then you use the automation GetLastError() method that will initialize an OleErrorInfo object with the members for you to check the actual error. Invoking COM methods and handling error are managed in the same way has you would handle a SAL API error. The only mechanism in Team Developer that supports something close to .NET exception is the specific case of SQL Error.

Because .NET are fully based on exception and those are event driven, Gupta Team Developer needs a mechanism to actually trap those event, in a global and local way, in pretty much the same ways as SQLError are currently handled.

Exceptions in OpenText Gupta Team Developer .NET target consuming assemblies

This is currently implemented in Team Developer using the new messages:

 SAM_NetException

Exceptions, results in a Dialog box with the information about the exception that happened. If you trap SAM_NetException, the default Team Developer exception/error handling will not be displayed. You can then use SalGetExceptionInfo() to display your own error or ignore it. This is directly analogous to how SQL errors are handled. Current limitations

.NET explorer

 No proxy generation for methods returning array of objects  No proxy generation for generic objects, events and delegates  No proxy generation for .NET COM Interop type of assemblies.

O P E N T E X T G U P T A T E A M D E V E L O P E R 23 WHITEPAPER | .NET Assemblies in Gupta TD 6

Since those are not generated, you cannot consume .NET assemblies using parts or all of the features above, both from a WIN32 and a WPF type application.

In the case of COM Interop type of object in a Win32 Team Developer application, you can still use native COM object in Team Developer as well as consume .NET assemblies that does not have the limitation mentioned above.

Creation of a Team Developer .NET class Library

 Exposing events is currently not supported  NET Generics currently not supported. (language limitation)  Currently no mechanism in TD to sign and install the assembly on the GAC  TD .Net class assemblies cannot be directly debugged traced. Conclusion

As mentioned in the overview of this document, Gupta Team Developer finally made it in the .NET world allowing you to build .NET application.

The implications are that you can now create .NET assemblies and consume them in a Team Developer .NET WPF target application but also in a WIN32 application. This opens to you the world of .NET without the immediate necessity of migrating fully your application to .NET, hence moving to .NET at your own pace.

Whether you will migrate your application to .NET or use an existing WIN32 application, consuming .NET object will further enrich the capability of your application, thanks to the richness of the .NET framework. You will also be able to share your Team Developer business logic with other .NET developer members and impress them with your productivity that is a characteristic of Team Developer you are well aware of.

O P E N T E X T G U P T A T E A M D E V E L O P E R 24 WHITEPAPER | .NET Assemblies in Gupta TD 6

About OpenText OpenText provides Enterprise Information Management software that enables companies of all sizes and industries to manage, secure and leverage their unstructured business information, either in their data center or in the cloud. Over 50,000 companies already use OpenText solutions to unleash the power of their information. To learn more about OpenText (NASDAQ: OTEX; TSX: OTC), please visit www.opentext.com.

www.opentext.com

NORTH AMERICA +800 499 6544  UNITED STATES +1 847 267 9330  GERMANY +49 89 4629 0

UNITED KINGDOM +44 0 1189 848 000  AUSTRALIA +61 2 9026 3400

Copyright ©2015-2016 Open Text Corporation OpenText is a trademark or registered trademark of Open Text SA and/or Open Text ULC. The list of trademarks is not exhaustive of other trademarks, registered trademarks, product names, company names, brands and service names mentioned herein are property of Open Text SA or other respective owners. All rights reserved. For more information, visit: http://www.opentext.com/2/global/site-copyright.html SKU#