You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We had an unpredicted failure because of the following:
we are constructing the functionality at runtime of a class (ETABS_Adapter) from within the class' constructor;
this functionality depends on another service (modules) which itself depends on the correct configuration of the class (ETABS_Adapter's Id).
The service module is not injectable via the ctor but is required to exist independently.
Because we had the incorrect ordering of instructions in the ctor (we declared the modules before the setting of the AdapterId), this raised a failure in the module loader, which required the AdapterId to be set.
Ideas
Possible solutions commonly adopted that require reworking the current architecture are:
Dependency Injection: e.g. ctor injection via an IoC container
Inheriting a base abstract adapter that exposes the functionality
Other solutions keeping current architecture are:
adding the dependency on AdapterId on the modules
making sure AdapterId is set before entering the ctor:
adding a static ctor
setting it as default value, never inside the non-static ctor
The text was updated successfully, but these errors were encountered:
alelom
changed the title
Reconsider the Adapter Modules mechanism
Improvements/reconsidering the Adapter Modules mechanism
Mar 8, 2023
alelom
changed the title
Improvements/reconsidering the Adapter Modules mechanism
Improvements/reconsidering the Adapter set-up and Modules mechanisms
Mar 8, 2023
Description:
As seen here: BHoM/ETABS_Toolkit#422 (review)
We had an unpredicted failure because of the following:
Because we had the incorrect ordering of instructions in the ctor (we declared the modules before the setting of the AdapterId), this raised a failure in the module loader, which required the AdapterId to be set.
Ideas
Possible solutions commonly adopted that require reworking the current architecture are:
Other solutions keeping current architecture are:
The text was updated successfully, but these errors were encountered: