Forum Discussion

Frank_Guarino's avatar
Frank_Guarino
Ideator I
8 months ago
Solved

Any way to instantiate a C# class that is within another method or file?

I have written a C# class helpful for me in refactoring some processing of an older method.

This C# class could prove helpful for other modules which perform the same logic. 

Is there anyway to have this class defined in a C# server method that I can instantiate whenever I want?

I know one can call a server method from a server method, but that will return AML and can do processing within it, but that would not be ideal as it would require extra work to lay out how to trigger to perform x or get y, etc. when I may only really need to do something small and then would need to make sure to return the correct AML and would become a mess if something else wants to do the same thing with a different return value in the AML, it would be unpragmatic.

So any way to instantiate a C# class? Do I need to go into the code tree or something?

Preferably I would like the class to share the lifetime of the server method which instantiates it.

Best Regards,

Frank

  • Hi Frank,

    This is not possible purely within the Innovator database itself. However, if you extract this class into a custom DLL, it would be possible to reference this DLL from your methods. You can see an example of this in section 8.27 of the Programmer's Guide.

    Note that I've linked the Release 33 version of the Programmer's Guide, but this functionality is not new and you should be able to find the relevant section in the Programmer's Guide of whatever version you are using.

    Hope this helps!

1 Reply

  • Hi Frank,

    This is not possible purely within the Innovator database itself. However, if you extract this class into a custom DLL, it would be possible to reference this DLL from your methods. You can see an example of this in section 8.27 of the Programmer's Guide.

    Note that I've linked the Release 33 version of the Programmer's Guide, but this functionality is not new and you should be able to find the relevant section in the Programmer's Guide of whatever version you are using.

    Hope this helps!