container icon indicating copy to clipboard operation
container copied to clipboard

Add Default extensions

Open ENikS opened this issue 5 years ago • 0 comments

Default Extensions

Unity v4 implemented two extensions:

  • UnityDefaultStrategiesExtension
  • UnityDefaultBehaviorExtension

These extensions were responsible for adding default policies, strategies, and factories to the container. The main benefit of these two was in standardized way an initialization took place. All the initialization code was in the same, well known location and was easy to learn and customize.

The problem was it created significant performance overhead.

The Problem

Extension implementation in both Unity v4 and v5 required the extension to be instantiated class. With memory allocated and time wasted as overhead. So, in Unity v5 these two extensions were removed to optimize performance and memory management. The initialization was implemented in part in constructor or as private methods.

Unity v6

Unity v6 solved extension overhead issue by allowing an action to be used instead of a class instance. This allows to bring back these two extensions without increasing overhead. It is a good idea to have initialization code all in the well known and documented location.

ENikS avatar Dec 24 '20 03:12 ENikS