Code Structure

CodeStencil provides a very simple way to develop Code Nanites. All you have to do is to use the Code Nanite Boilerplate Stencil to generate a Visual Studio C# Solution complete with all the necessary files.

Let us take a look at a Code Nanite - GetPrimaryKey that returns  the primary key in a passed table.

These are  the major files needed for a Code Nanite DLL:

  1. Main Class - GetPrimaryKey.cs
  2. Functions - GetPrimaryKey.Functions.cs
  3. Expander Object - ExpanderObject.cs
  4. Expander Base - ExpanderBase.cs

 

How it works

A call  ( MainFunction() ) is made from GetPrimaryKey.cs to GetPrimaryKey.Functions.cs. The code is auto generated when you use the Boilerplate Stencil to generate this solution.


        public void ExecutePlugin()
        {
            Initializer(SchemaItem, Expander);
            MainFunction();
        }

Ideally, the only file that should need your update/code will be GetPrimaryKey.Functions.cs, and your code starts in the MainFunction() method.


        private void MainFunction()
        {
            Output = GetTable(Input) +"."+ GetPrimaryKey(Input) ;
        }

The result goes into the property - Output which CodeStencil is able to receive with a call like this:

 

 

© 2018 CodeStencil - Zera Systems Inc. All Rights Reserved.

No items in cart