As a web developer I have often had to work with the session, cookie, query string and cache to persist data locally. But it has always struck me that there was no neat way of doing so. So I came up with this wrapper which
is meant to provide a simple and unified model to work with local storages. It is type safe and supports complex data types even when working with cookies and query strings, thanks to Json serialization. Also a
variable can seamlessly be based on more than one persistence type if need be.

Below is a sample code that creates an object to store and integer in a session under the key "counter":

var count = new DynamicStore("counter");

The Value property is used as follows to manipulate the integer:

count.Value = count.Value + 10;

Now to store the integer in a cookie the Sources.Cookie argument can be used as follows:

var count = new DynamicStore("counter", Sources.Cookie);

And this is how the Sources enum is declared whereby Sources.Session is the default when not specified:

In the above example the object will first look for the specified key in the session. If this attempt fails then the request will turn to the next sources cookie and cache in the queue.

By default our object value is saved to all the targets in the source list(ie session, cookie and cache in our case). You can avoid writing to the cache, for example, by limiting the target types to the session and cookie as follows:

Note that "_" is the default delimiter used to seperate the parent a.nd the child key. It is also the default key delimiter used with cookies since they inherently support parent/child keys.

Note that you can call the ToString() function on any object having a complex generic type to obtain its Json representation.

This wrapper brings a lot of flexibility but you should avoid saving more data to cookies and query strings than they can handle. A cookie will automatically clear itself when it grows beyond its size limit. To help overcome those issues an error will be thrown
whenever the query string size grows beyond its 2048kb size limit and cookie compression has now been implemented.

More information on this project will be added with time if it gets enough traction from the community and meanwhile, of course, your suggestions, questions and critics are most welcome.