Is there any reflection performance considerations when repeatedly calling container.Resolve<T>()
when a resolution has already been established?
I'm using it in an MVC controller to resolve my data service, so it will be called on every HTTP request. I'm storing the container instance in Application state, and I'm using container controlled lifetime so it maintains a singleton instance of my resolved class. My assumption is that while the container is alive and has created a new instance of the service, it will not need to use reflection on subsequent calls to resolve it.
I'm considering keeping a reference to the resolved class instead if performance of Resolve<T>()
is an issue. But with the singleton lifetime setup, it seems like I would be duplicating something that's already built-in.