Skip to end of metadata
Go to start of metadata

Version of Jiwa included some changes that will likely cause plugins or applications using our assemblies to no longer compile, or produce unexpected errors at runtime.

What changed

We deprecated the Instance singleton property

"Instance" property has been deprecated (marked as obsolete) in the JiwaFinancials.Jiwa.JiwaApplication.Manager class.

The Manager class has a property named Instance, which could be used like this:

Old Login Example
JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance.Logon("MyServer", "JiwaDemo", JiwaFinancials.Jiwa.JiwaODBC.database.AuthenticationModes.JiwaAuthentication, "Admin", password);
var db = JiwaApplication.Manager.Instance.Database;
using (SqlCommand SQLCmd = new SqlCommand(sql, db.SQLConnection, db.SQLTransaction))

The above example - whilst it still compiles - is no longer supported.


To address this, you should no longer refer to the singleton instance property, but instead use an instance of the Manager class instead:

New Login Example
var manager = new JiwaFinancials.Jiwa.JiwaApplication.Manager();
manager.Logon("MyServer", "JiwaDemo", JiwaFinancials.Jiwa.JiwaODBC.database.AuthenticationModes.JiwaAuthentication, "Admin", password);
var db = manager.Database;
using (SqlCommand SQLCmd = new SqlCommand(sql, db.SQLConnection, db.SQLTransaction))

As many classes require access to the Manager class instance, removing the singleton instance property meant we now needed to add a Manager property to all our Forms, Dialogs and Business Logic.

Our interfaces which are implemented by all our Forms, Dialogs and Business Logic have had a Manager property added:

  • JiwaFinancials.Jiwa.JiwaApplication.IJiwaBusinessLogic
  • JiwaFinancials.Jiwa.JiwaApplication.IJiwaCollection
  • JiwaFinancials.Jiwa.JiwaApplication.IJiwaCollectionItem
  • JiwaFinancials.Jiwa.JiwaApplication.IJiwaDialog
  • JiwaFinancials.Jiwa.JiwaApplication.IJiwaEntity
  • JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm

So all classes implementing the above interfaces now have a Manager property also. We also included in the above interfaces a Setup method. The factories should always be used to create a new instance of any class implementing the above, as the factory will set the Manager property and then invoke the Setup method of the newly instantiated object.

The factories are accessible via properties of the Manager class - these are BusinessLogicFactory, CollectionFactory, CollectionItemFactory, DialogFactory, EntityFactory, FormFactory.

An example of using the Entity Factory of the Manager:

Entity Factory Example
var branch = Manager.EntityFactory.CreateEntity<JiwaFinancials.Jiwa.JiwaApplication.Entities.Sales.Branch>();


An example of using the CollectionItem Factory of the Manager:

CollectionItem Factory Example
var debtorPrice = Manager.CollectionItemFactory.CreateCollectionItem<JiwaFinancials.Jiwa.JiwaInventory.DebtorSpecificInventorySpecific>();


Why the changes were made

We found that in the development of our REST API, the singleton pattern was inhibiting the ability to have multiple users using the REST API concurrently. In order for us to provide the REST API we had to move away from the singleton pattern.

DEV-5680 - Getting issue details... STATUS

Migration Steps

Use factories

Always use a factory to create an instance of a class implementing any of the following interfaces:

  • IJiwaBusinessLogic
  • IJiwaCollection
  • IJiwaCollectionItem
  • IJiwaDialog
  • IJiwaEntity
  • IJiwaForm

Move constructor code to Setup method

Any classes implementing the above interfaces should not have any reference in their constructor to their Manager property - move that to the Setup method and ensure the first line of code in the overridden Setup method is calling the base Setup method.

Example Setup override
public override void Setup()
    _Debtor = Manager.EntityFactory.CreateEntity<JiwaApplication.Entities.Debtor.Debtor>();