Manager.Instance Instance property is deprecated  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Manager.Instance Instance property is deprecated

Postby nsbandara » Tue Oct 10, 2017 2:41 am

Hi,

I recently upgraded a Jiwa plugin from version 7.0.175 to version 7.1 and noticed
Code: Select all
JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance
property is deprecated.

What is the recommended way to upgrade above line of code when deploying plugin from older version to Jiwa 7.1 ?

Thanks.
User avatar
nsbandara
Occasional Contributor
Occasional Contributor
 
Posts: 43
Joined: Tue Jul 16, 2013 5:02 pm
Location: Sri Lanka
Topics Solved: 11

Re: Manager.Instance Instance property is deprecated  Topic is solved

Postby SBarnes » Tue Oct 10, 2017 6:46 am

This code is not deprecated and won't be for I think its 12 months and therefore any code using this should compile and run under 7.1 so long as its in the user interface but should be upgraded at some point not only due to the deprecation but for scalability.

However in terms of upgrading code that can depend on the context, for example each form has its own manager so from the form plugin you can do the following

Code: Select all
    public void Setup(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
    {
      JiwaForm.Manager
    }


Each Business Logic Object has a manager so the following is also valid

Code: Select all
    public void Setup(JiwaFinancials.Jiwa.JiwaApplication.IJiwaBusinessLogic JiwaBusinessLogic, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
    {
      JiwaBusinessLogic.Manager
    }


Each Plugin has its own manager so the following is also valid

Code: Select all
    public void Setup(JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
    {
      Plugin.Manager
    }


Each Jiwa Grid etc has its own manager so this is also valid

Code: Select all
    public void FormatCell(JiwaFinancials.Jiwa.JiwaApplication.IJiwaBusinessLogic BusinessLogicHost, JiwaFinancials.Jiwa.JiwaApplication.Controls.JiwaGrid GridObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm FormObject, int Col, int Row, JiwaFinancials.Jiwa.JiwaApplication.IJiwaLineCustomFieldValues HostItem, JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomField CustomField, JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomFieldValue CustomFieldValue)
    {
      BusinessLogicHost.Manager
      GridObject.Manager
    }


Instantiating a business logic object once you have a manager is as simple as

Code: Select all
JiwaFinancials.Jiwa.JiwaInventory.Inventory result = Manager.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaInventory.Inventory>(null);


Instantiating a form uses
Code: Select all
Manager.FormFactory.CreateForm


and instantiating a dialog something like

Code: Select all
_myForm = salesform.Manager.DialogFactory.CreateDialog<AttkeyOrderConsolidation.frmBackOrderListing>(salesform);


I would also suggest you read the following article that Mike has generously spent time putting together in case you need to instantiate your own Manager and any manager has the login details for the current database in which code is running

https://docs.jiwa.com.au/display/J7UG/How+to+convert+plugins+or+code+to+be+compatible+with+7.00.177.00+or+later

I hope this explains enough
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175


Return to Technical and or Programming

Who is online

Users browsing this forum: FAST WebCrawler [Crawler] and 22 guests