Seems nobody is writing down simple examples of how to use the CAB mechanisms, so here is a snippet that might be useful to somebody one day…
[csharp]
public IStatePersistenceService PersistenceService
{
get
{
return Services.Get
}
}
…
if (PersistenceService.Contains(“SomeKey”))
Console.WriteLine(PersistenceService.Load(“SomeKey”)["a"].ToString());
else
{
State s = new State(“ab”);
s["a"] = ” Some string you want to persist, e.g. a favorite item.”;
s["b"] = new SomeObjectYouNeedToSave();
PersistenceService.Save(s);
}
[/csharp]
Some (self-indulgent) overview of G2's interface hierarchy is available.
Read moreThe Enterprise Library 4.1 was released together with Unity 1.2 in which a whole interception mechanism was added as part of the aspect-oriented approach to coding and a merge of the policy injection ideas. This little note is just a stepping stone if you wish to play with the new interception namespace.
Read more