Shiraz Bhaiji
Shiraz Bhaiji

Reputation: 65411

Performance of Microsoft Unity Container

I am reviewing a project that has used Microsoft Patterns and Practices Unity Container.

There is a single container with 40 registered types, an instance of the container is created for every web service call.

I am wondering:

The web services are hosted in IIS.

Upvotes: 4

Views: 3632

Answers (2)

Chris Tavares
Chris Tavares

Reputation: 30411

Unity caches all sorts of stuff under the hood the first time a resolve is done. This significantly improves performance on later resolve calls. If you create a new container on every request, you're throwing out those caches.

Keep the container around between requests.

Upvotes: 12

SharePoint Newbie
SharePoint Newbie

Reputation: 6082

Please create the container and register all types during Application_Start. We've done this for around 200 + types in a large project (wcf and asp.net mvc) and have had no issues.

Thanks

Upvotes: 8

Related Questions