I have a class library that should encapsulate ORM logic. To avoid some db calls, it should contain some kind of cache or static variables (I want to avoid them). It is used in asp.net and wcf applications. Since this is a class library, I do not want to access the cache or other asp.net-related materials. I also want to avoid static vars due to their application nature.
How do I implement this? What are you doing to achieve this?
EDIT:
To simplify: imagine a class library encapsulating a DAL. He is negotiating with a database. There are several expensive queries inside. Some of them must be retrieved once for each user and stored somewhere, and some of them can be used for each application (also saved to avoid future calls to the database). The fact is that I usually use Cache, but since this is a DAL class library, I want to enable this functionality inside it (and not in asp.net). Hopefully this will become clearer now;)
source
share