Hi,

Now studying disconnected state, found a strange behavior (which I'm trying to believe is my mistake but I can't find it. Here's the piece of code:

foreach (Item anItem in Collection.Where<Item>((item => item.Entity1.Equals(anEntity1) && item.Entity2.Equals(anEntity2))))

In this snippet, "Collection" is an EntitySet<item>. The method with this code is being tested by standard MSTest tests.

The above snippet will work (i.e. it will correctly find the items in Collection matching the criteria) if I'm working in standard mode with DO4.

When I'm working in Disconnected State, even inside a .Connect() using block, it won't work the same despite the fact that "Collection", "anEntity1" and "anEntity2" have the exact same state than when in "Connected Mode".

The really weird behavior is that a simple change in the snippet above seem to fix everything in disconnected mode:

foreach (Item anItem in Collection.ToList().Where<Item>((item => item.Entity1.Equals(anEntity1) && item.Entity2.Equals(anEntity2))))

The simple fact that I generate a list from the EntitySet before applying the .Where extension, seem to fix the issue.

Am I missing something really obvious here? Or is this truly strange?

Thanks!

asked Jun 14 '12 at 15:22

pgoes's gravatar image

pgoes
216610


One Answer:

Hello Pedro,

unfortunately DisconnectedState has poor design and unclear semantics. Its usage is not recommended. For simple scenarios (e.g. WinForms/WPF applications) you can use sessions in ClientProfile mode. This mode rectifies DisconnectedState problems. We are going to improve it and remove DS from implementation in future while keeping the same API and semantics.

For truly disconnected operations we are developing Microsoft Sync Framework extension which is expected to be available within a month.

answered Jun 22 '12 at 06:13

Denis%20Krjuchkov's gravatar image

Denis Krjuchkov
179325

edited Jun 22 '12 at 06:13

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×5

Asked: Jun 14 '12 at 15:22

Seen: 3,827 times

Last updated: Jun 22 '12 at 06:13

powered by OSQA