Registration by Assembly Scanning
- Create a basic attribute called "RegisterType" that you could place on a class, The options I've found most useful are an enum to define it's lifetime manager and addtional type attributes to filter out types you don't want to register, IDisposable etc.
- Create an optional attribute that can be put in the assembly to indicate it should be scanned. This is optional but can be helpful for performance reasons.
- Create a Unity extension that reads all loaded types (I've found tricks for web applications here) and scans for this attribute and registers matching types.
50
votes
Daniel Piessens
shared this idea
-
Dzmitry Lahoda commented
I like "Create an optional attribute that can be put in the assembly to indicate it should be scanned. This is optional but can be helpful for performance reasons. " from this, but as extension, not part of Unity.
-
Dzmitry Lahoda commented