Automatic registration by attributes for .net

In general, when I started writing drawing in my crud generator, I noticed that I again wrote a class that registers everything in the container by attributes.

Decided to make a separate project. Added registration of multiple implementations, or specific implementations with LifetimeManagement management (for Unity).

How to use?

Add TypeRegistrationAttribute to the base entity whose implementations you want to register in the container.

Add DerivedTypeRegistrationAttribute per implementation to override LifetimeManagement.

Specify LifetimeManagementType.

summon UnityCommonRegistration.Register(container).

How to add your container?

override 2 methods – registerInContainer, registerManyInContainer.

Write your mapping for LifetimeManagementType.

Where to get?


Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *