Domain entities into (ASP.NET) Session, or better some kind of DTOs?
- by Robert
Currently we put Domain Objects into our ASP.NET Sessions.
Now we considering moving from InProc sessions to state server. This requires that all objects inside session are serializable. Instead to annotate all objects with the [Serializable] attribute, we thought about creating custom-session objects (DTO Session Objects?), which only contain the information we need:
CONS:
Entities must be reloaded, which requires additional DB round-trips
PROS:
Session State is smaller
Session information is more specific (could be a CON)
No unneeded annotation of Domain-Entities
What do you think? Should we use some kind of DTOs to store inside the session, or should we stick with god old entities?