AnsweredAssumed Answered

Parallel CheckIns to AF Database allways fail.

Question asked by VarbanVarbanov on May 26, 2015
Latest reply on Jun 1, 2017 by gregor

Hi, we are using our custom WCF Service for writting assets in AF Database for quite some time.
There has allways been a following problem : when two calls try to add assets they fail with the following exception:

 

A first chance exception of type 'System.InvalidOperationException' occurred in OSIsoft.AFSDK.dll

Additional information: Element 'XXX' with UniqueID '84403e58-fff4-4721-8947-18e4f999cb12' is not checked out by the requesting user.

 

This also happens when somebody has checkout elements in Pi System Explorer.
The service is just adding or editing (mainly) multiple elements and at the and makes this call:

 

  private void CheckIn()

        {

            if (_afDb.HasItemsCheckedOutToMe)

            {

                _afDb.CheckIn(AFCheckedOutMode.ObjectsCheckedOutToMe);

            }

        }

 

NOTE! The described behavior does not change with any of the values of AFCheckedOutMode (except "All" which is not allowed). The service does not maintain session and does not use multilple threads inside (i.e only the calling thread). Does anybody knows solution to this problem?

Outcomes