How to Add Custom Functions in Centerprise

In this article, we'll discuss how to create and deploy a custom function in Centerprise.  This article assumes at least a basic understanding of .NET and programming in general.

Create the Project

Create a new .NET project using Visual Studio or any other compiler that supports the .NET Framework.  You can choose any name you want for the project and resulting assembly.  In this example, we'll name it "Centerprise5CustomFunctions." 

Important!  Suffix your output assembly with the words PlugInCenterrpise will only load assemblies with this suffix!

Add Centerprise References

Add references to the Centerprise runtime.  This can be done from either the client installation folder or the server installation folder.  You'll find two .dlls: Astera.Shared.dll and Centerprise.NET.dll.  Add these two to your project as assembly references.

references.png

Write the Custom Function

Next, write the custom function itself.  It can be written in a single file or one function per .cs file, whichever style suites you best.  The name of this file is irrelevant. 

There are a couple of items of importance here:

Make sure you include the Centerprise reference by putting a "using" statement at the top of the .cs file.  You'll need one for Astera.Transfer and one for Astera.Core. 

You'll need to decorate your class with the "RuleFunctionClass" attribute.  This is to indicate to Centerprise that this class is to be used as a custom function.

You'll also need to use the "Function" attribute on the method itself.  You'll need to put this on every single function you wish to use in Centerprise within this class.  Note that this attribute is used to provide a description about what your custom function does. 

The "Category" attribute will determine where in the list of categories your custom function will show up.  Setting this to an unknown category will result in the creation of this new category.

The "Parameter" attribute takes in two parameters.  The first is the name of the parameter and the second is the description of the parameter.

classdefinition.png

Compile Your Custom Function

Next, compile your custom function.  The .dll you'll want to look for can be found in the output "obj" folder.  Copy this file and any dependent assemblies to prepare for deployment.

Note: Make sure that your output assembly's name ends in .plugin.dll.  For example, you can call it Sample.Plugin.dll.

dll.png

Deploy Your Custom Function

Paste your assembly that contains the .dll under the PlugIn folder of BOTH the client and the server.  The client plug-in folder can be found under  "[Program Installation]\Astera Software\Centerprise Data Integrator 6\Client\Plugin."

clientdeploy.png

Make sure you place your custom function under the server plug-in folder as well.  This can be found under "[Program Installation]\Astera Software\Centerprise Data Integrator 6\Client\Plugin."  Make sure if you are using a Centerprise server, you place the same .dll in BOTH places.  They are two separate applications and they will not be aware of each other's custom function deployment.

serverdeploy.png

Create a Plug-In Registration File  (No longer necessary after 5.1.234)

Next, create an xml file called PluginAssemblies.xml and place it in the installation folder of Centerprise.  If you are using a server, you'll have to deploy this file in BOTH client and server directories.  The file MUST be named PluginAssemblies.xml.

 Edit Contents of Plug-In Registration File

Finally, edit the contents of the PluginAssemblies.xml file and enter the structure exactly as follows (where Centerprise5CustomFunctions.dll is replaced by the name of your assembly):

<PluginInformation>
    <Plugins>
        <PluginAssembly>
            <AssemblyPath>.\PlugIn\Centerprise5CustomFunctions.dll</AssemblyPath>
        </PluginAssembly>
    </Plugins>
</PluginInformation>

 Test Client Deployment

Now you're ready to use your custom function.  To make sure it is there, open a new dataflow and drag and drop the function component onto the diagram.  You should see your function in there.  If you do, it's ready for use!  If not, check to make the path is correct in the PlugInAssemblies.xml file.

success.png

 

 

Have more questions? Submit a request

1 Comments

  • 0
    Avatar
    Christophernewmark

    You also need to add the assembly Astera.Core.dll or C# will complain when add the statement using Astera.Core and the [RuleFunctionClass] attribute. At least, it did for me.

Please sign in to leave a comment.