Site Map
Skip Navigation Links
Home
ProductsExpand Products
SupportExpand Support
PartnersExpand Partners
CompanyExpand Company
Your Account
sign in

Custom Function Sample

This is an example of how a class would be written in C# so that it may "plugged-in" to our data transformation products that use our proprietary Rules Engine technology.  To use, compile the code below as a class library and copy the resulting output .dll file into the PlugIn directory under the application directory (e.g. C:\Program Files\Astera Software\Astera DataMapper 2008\PlugIn).  After this is done, the next time you start the application, you'll see the below function under the "Custom Sample" category in the expression builder.  To use custom functions, you must have .NET 2.0, a C# compiler, and basic programming skills.  Once you start using custom functions, you'll find that the types of mapping that can be perform become almost limitless.

using System;
using System.Collections.Generic;
using System.Text;
using Astera.Core;

namespace CustomRuleFunctionSample
{
/// <summary>
/// This class represents a sample for defining custom rules expression functions.
/// All classes containing rule functions must
/// have attribute RuleFunctionClass. All functions must be declared
/// public static and must have RuleFunction attribute. Other attributes
/// are optional. However, it is recommended that
/// you provide description of attribute and category. This information is displayed as tooltips
/// in the rule expression editor and expression builder. A class may contain multiple functions.
/// /// Once compiled, the dll must be dropped in PlugIn folder under the program files\Astera Software\Product Name folder.
/// These DLLs are automatically picked up at application startup and functions will show in rule function lists and
/// intellisense dropdowns.
/// </summary>
[ RuleFunctionClass]
public class CustomFunctionSample
{
[Function( "This function demonstrates use of Plug-in function in Astera Expression Engine.")]
[Category("Custom Sample")]
[Parameter("str1", "First string")]
[Parameter("str2", "Second string")]
public static string Concatenate( string str1, string str2)
{
return string.Format( "{0}{1}", str1, str2);
}
}

}
 
  Copyright © 2008 Astera Software
Home | Products | Support | Partners | Company