How can I call execute c# code from my server in a bezl?

You can write custom c# code on your Bezlio Remote Data Broker server and execute that code inside of a bezl. We call this Dynamic Plugins, and it is incredibly powerful for integrating with a variety of different systems.

Bezlio data subscriptions can be built using two different techniques. One technique is to use the plugins available in the installer. These cover common integration methods such as reading data from Microsoft SQL Server, ODBC, Excel, REST, and many more.

But Bezlio also allows you to write your own plugins using C# and having them dynamically compile to expose them to your bezls. This is super helpful because it allows you to write your own business objects for your bezls and call other C# libraries to make integration with other systems even more powerful.

Dynamic plugins start in the Dynamic folder in your Bezlio Remote Data Broker installation folder. By default there is a references.json file and nuget.exe located in the install folder. Any files with a .cs extension will be compiled when the service restarts and will be exposed to developers.

The references.json file allows you to include third party libraries. 

2019-10-02 14_17_58-Window

In this case I am including the Epicor ERP 10 Business Objects, note that because this is dynamic you need to include all of the files that you will need. If you are missing any, errors will be output to the Event Viewer and the dynamic plugin that was unable to compile will not show up in Bezlio. Note here also that I am also including the Newtonsoft JSON library from my Bezlio installation directory. This is useful for passing in complex objects, and deserializing them in the method.

As you can see from my folder listing, I also have a file called Epicor.cs, this is our dynamic plugin. You can have as many .cs files as you’d like.

2019-10-02 14_20_59-Window

Here you can see I can just write regular C# code calling the third party libraries I included in my references.json file. In Bezlio, the plugin will appear as namespace.class, all of the methods will show up, along with their method signature. Note, all parameters have to be passed as strings, which is where Newtonsoft JSON can come in helpful!

2019-10-02 14_24_54-Window

When you select a method, the method signature shows up.

2019-10-02 14_25_59-Window

You can now use your dynamic plugin the same way you would use the included plugins!