Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 921 Bytes

readme.md

File metadata and controls

37 lines (26 loc) · 921 Bytes

LifetimeAttributes

This library was created to make service registration into DI container easier. Advantages:

  • You no longer need to write a long registration code in a separate file ServiceCollectionExtensions.
  • It is easy to understand what kind of life cycle the service has

Plans:

Functionality

  • Attributes of different life cycles
[Transient]
public class Service1{}
[Scoped]
public class Service2{}
[Singleton]
public class Service2{}
  • Registration of tagged services
serviceCollection.AddServicesWithLifetimeAttribute();

Static analysis:

  • Checking the implementation by the class of the interface specified in the attribute

Implementation analyzer

  • Checking that if the registered class has a Singleton life cycle, so that the infected classes also have such a cycle