Version 7.00.177.00 of Jiwa included some changes that will likely cause plugins to no longer compile, or produce unexpected errors at runtime.
What changed
We removed the JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance singleton property
The Manager class had a property named Instance, which could be used like this:
JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance.Logon("MyServer", "JiwaDemo", JiwaFinancials.Jiwa.JiwaODBC.database.AuthenticationModes.JiwaAuthentication, "Admin", password); JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder>()null; var db = JiwaApplication.Manager.Instance.Database; using (SqlCommand SQLCmd = new SqlCommand(sql, db.SQLConnection, db.SQLTransaction)) { }
The above example will now fail to compile, giving the error "'Instance' is not a member of 'JiwaFinancials.Jiwa.JiwaApplication.Manager'".
To correct this, you can no longer refer to the singleton instance property, but instead use an instance of the Manager class instead:
var manager = new JiwaFinancials.Jiwa.JiwaApplication.Manager(); manager.Logon("MyServer", "JiwaDemo", JiwaFinancials.Jiwa.JiwaODBC.database.AuthenticationModes.JiwaAuthentication, "Admin", password); manager.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder>()null; var db = manager.Database; using (SqlCommand SQLCmd = new SqlCommand(sql, db.SQLConnection, db.SQLTransaction)) { }
As many classes require access the 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 - and provide a way of setting that property.
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. The factories should always be used to create a new instance of any class implementing the above.
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:
var branch = Manager.EntityFactory.CreateEntity<JiwaFinancials.Jiwa.JiwaApplication.Entities.Sales.Branch>(); branch.ReadRecord("ABC123");
An example of using the CollectionItem Factory of the Manager:
var debtorPrice = Manager.CollectionItemFactory.CreateCollectionItem<JiwaFinancials.Jiwa.JiwaInventory.DebtorSpecificInventorySpecific>(); debtorPrice.Debtor.Search(); Inventory.DebtorPrices.Add(debtorPrice);