google-code-export / dataobjectsdotnet

Automatically exported from code.google.com/p/dataobjectsdotnet
0 stars 0 forks source link

Implement DisconnectedState.Chain method #859

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
Related: issue 858.

Original comment by alex.yakunin on 27 Nov 2010 at 2:29