Sunday, October 16, 2016

State maintenance in the MVC DevExpress paradigm is super painful!

The how to for communicating records from a view to a partial across a callback refresh in the DevExpress paradigm is tricky. You cannot use a backing store in the traditional sense (a field or a getsetter) which basically means you are left with:

  1. putting things in the cache
  2. or serializing types to strings, letting strings travel from C# into JavaScript and then back to C# and then deserializing

In the first approach, you will use a magic string (maybe a GUID) for a key to a bit of the cache that should expire in fifteen minutes (strongly recommend, and I mean the cache contents should expire not the GUID, mkay?) and that magic string will, like serialized gunk, go from C# to JavaScript and back to C#. You can also go to the database every time you reload a partial to rehydrate obviously if you want to forgo lingering state conceptually altogether. It's up to you as to if that makes sense. I assume you cannot just use Session. I've had the worst AJAX experiences with Session.

Addendum 10/25/2016: You can somewhat use Session, in a sickly way. See: this

No comments:

Post a Comment