Microsoft Unity Container Performance

I am looking at a project that uses the Unity Container Microsoft Patterns and Practices.

There is one container with 40 registered types, a container instance is created for each web service call.

I am wondering:

  • Is there a performance issue due to registering a large number of types?
  • Can I use the unity container between web service calls?

Web services are hosted on IIS.

+4
source share
2 answers

Create a container and register all types during Application_Start. We did this for about 200+ types in a large project (wcf and asp.net mvc) and had no problems.

thanks

+7
source

Unity caches all kinds of things under the hood at first resolution. This greatly improves performance on subsequent permission calls. If you create a new container for each request, you throw away these caches.

Keep container between requests.

+12
source

Source: https://habr.com/ru/post/1336432/


All Articles