mercredi 15 août 2018

Performance for Dependency Injection - Web Api c#

I have been developing an API with .NET Core 2 and I am putting together several learning about design patterns. Lately I've been feeling confused as to whether I'm actually applying the pattern correctly. The project is based on Controllers, Services, Repository and a management I created to handle errors.

The point is that everything revolves around dependency injection and whatever structure I create for the project I have to define it in the Startup file as Singleton. According to the image below, the DI statements are growing with every resource I create (what the picture shows is only a part).

Some of the DI statements

Do you have a pattern that says how to follow these statements?

NOTE: I feel that the API is a little slow compared to other projects that do not follow the same pattern, although I have a nice idea that adding references as singleton prevents classes being instantiated at all times

Aucun commentaire:

Enregistrer un commentaire