Domain entities into (ASP.NET) Session, or better some kind of DTOs?

Posted by Robert on Stack Overflow See other posts from Stack Overflow or by Robert
Published on 2010-06-05T10:30:33Z Indexed on 2010/06/05 10:32 UTC
Read the original article Hit count: 132

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about session