Navigation: CodeStencil > Code Nanites > Creating Code nanites > Code Structure |
Let us take a look at a Code Nanite - GetPrimaryKey that returns the primary key in a passed table.
These are the major .cs 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
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: