Genexus Extensions SDK - How to develop extensions for Genexus Server?

Viewed 104

I'm trying to develop .NET Framework Extensions for Genexus Server to listen to basic events like:

  • Lock Events
  • Commit Events
  • Update Events

EDIT

I have tried pasting packages that derives from AbstractPackage and implements IGxPackageBL from Genexus SDK inside GXServerInstance/VDir/BinGenexus/Packages folder and listen to LockEvents using the EventSubscription with ServerEvents.BeforeLockObject but the package doesn't seen to be initialized with Genexus Server. This Class comes from Genexus.Server.Common.ddl.

Here is what I tried so far:

I created the project from the "Genexus Package Visual Studio Template":

enter image description here

Package.cs

enter image description here

AssemblyInfo.cs

enter image description here

The Extension doesn't seen to be loaded, here is what the https://mygxserver/v16/extensions.aspx shows:

enter image description here

The GXServer.log file doesn't seen to be logging any errors, and shows that the extension was actually loaded, despite not working...

enter image description here

  • How can I setup an extension for Genexus Server (16)?
  • What DLLs From the server can I use to implement functionalities to my extension?
1 Answers

GeneXus Server extensions are developed the same way as GeneXus extensions, and have to be installed in the path that you mentioned. The distinction here is that GXserver only loads BL extensions.

You can classify extensions in two ways:

  1. UI extensions: These extensions are loaded only in GeneXus IDE, and can add user interface components, such as tool windows, toolbars, menus, commands, editors, etc.

  2. BL extensions: These extensions are loaded whenever the business logic layer is loaded. This is, besides when running GeneXus IDE, it also includes when running MSBuild tasks, or when GXserver service is loaded. These kind of extensions commonly:

    • Add new object types
    • Add new parts to objects
    • Add new properties to objects
    • Implement services defined in SDK or other shared assemblies

In order for an extension to be considered a BL extension, it must comply with the following:

  1. The Package class must extend AbstractPackage and implement IGxPackageBL. eg:

    public class Package : AbstractPackage, IGxPackageBL
    

    I noticed in the image provided, that the implementation of IGxPackageBL is missing. This interface doesn't define any new members to the package beside those already inherited from AbstractPackage, but the package loader checks for it anyway.

  2. Inform in the PackageAttribute that the package is NOT a UI extension. eg:

    [assembly : PackageAttribute(typeof(Package), IsUIPackage = false)]
    

After making these changes, and copying the package assembly inside the VDir\BinGenexus\Package folder, you can navigate to the extensions page (eg: https://mygxserver/v16/extensions.aspx) in your browser, and you should see your extension loaded.

As for the binaries you can use, the GXserver SDK is a work in progress. In v17 we started distributing a new folder with the SDK named BinServer which includes the binaries we are comfortable making part of the SDK, which at the moment contians Genexus.Server.Common.dll and GeneXus.Server.ExternalTool.dll.

Related