I am using AutoFac and have a custom caching implementation. When I register type of the Cached implementation, I configured the caching service as as a SingleInstance(). However, this prompts issues with the database connection (using EF) because the second concurrent request tries to access a closed connection.
Builder.RegisterType<MyCachingDataService>().As<IMyCachingDataService>().SingelInstance();
Hence we removed the SingleInstance() and made it default instance per call, now the issue is that it kind of defeats the purpose of caching if we do an instance per call, that way it is less performant.
What is the way around this, what am I doing wrong.