Szenario:
I have read the book P of EAA by Martin Fowler and stumbled over the pattern called Identity Map. I've thought about using this pattern in an ASP.NET MVC application.
Question:
As far as I know the ASP.NET MVC request life-cycle always kills all objects after a request got processed, which means my domain layer / mapping layer (containing my Identity Map) would be cleared as well. How can I use this pattern (see below) in a stateless environment like ASP.NET MVC? Does it make sense in a stateless environment? Could I make the Identity Map static and introduce a session id to regain my objects I have already loaded?
Identity Map:
Ensures that each object gets loaded only once by keeping every loaded object in a map. Looks up objects using the map when referring to them. Martin Fowler