mdsterman

PI Batch Web API Encapsulation

Discussion created by mdsterman on Sep 19, 2019

          

PI Batch does not have web api access.  I have built a simple application to wrap PI Batch server access into an MVC controller.   Code looks like this:

 

               myServer = g_SDK.Servers["XXXXX"];

                _myServer.Open("SERVERROLE=RequirePrimary");

                PIModuleDB PIDb = _myServer.PIModuleDB;

 

What is the best strategy to encapsulate this, given multiple client calls.  Should the server be closed after each access?  Should any of these be static members?  Should this be encapsulated in a static function?  We have found this to work best using the “RequirePrimary” option.  Any help would be appreciated.

Outcomes