Indended usage:
var baseState = new DisconnectedState();
... // Let's think we cached lots of dictionaries there
var formState = new DisconnectedState();
using (formState.Chain(baseState))
using (var session = domain.OpenSession())
using (formState.Attach(session))
using (formState.Connect()) {
// Do anything with form here.
// Session fetches from formState first,
// then from baseState, and then - form actual DB.
// Any newly fetched or modified data is cached in
// formState.
// formState.SaveChanges() goes directly to Session,
}
// baseState isn't modified here.
// But if user wishes, he can invoke
// baseState.Merge(formState,
// MergeMode.PreferNew | MergeMode.MergeChanges).
Original issue reported on code.google.com by alex.yakunin on 27 Nov 2010 at 2:28
Original issue reported on code.google.com by
alex.yakunin
on 27 Nov 2010 at 2:28