Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Synchronising EcoSpaces

0 views
Skip to first unread message

Sean Thomas

unread,
Dec 7, 2005, 6:22:55 PM12/7/05
to
I have a C# app that is working fine without synchronisation. I am now
trying to add synchronisation.

I have looked at "A Multi-Client-ECO application example." by Mr. Roland
Kossow on "How to do things" and followed the steps indicated.

The syncronisation works OK when I add a new object. The following code
causes a second client to update:

EcoSpace.PersistenceService.RetrieveChanges();
foreach (IChange c in EcoSpace.PersistenceService.GetChanges())
{
if (c.IsDirectConflict)
{
c.Action = ChangeActionKind.Discard;
}
else
{
c.Action = ChangeActionKind.Keep;
}
}

EcoSpace.PersistenceService.ApplyAllChanges();
EcoSpace.UpdateDatabase();

However if I modify an object by changing an attribute, like "Name", the
second client does not update? Should it?

Is there some way to force an object to refresh itself from the server
EcoSpace?

I only have Pascal examples of the server setup. Is there a C# one?

Kind regards

Sean

Peter Morris [Droopy eyes software]

unread,
Dec 8, 2005, 9:00:16 AM12/8/05
to
> if (c.IsDirectConflict)
> {
> c.Action = ChangeActionKind.Discard;
> }
> else
> {
> c.Action = ChangeActionKind.Keep;
> }
> }

I suspect that those are the wrong way around.

If you are in direct conflict, you want to "Keep" your copy, otherwise you
should always Discard. Personally I would always Discard no matter whether
it is a conflict or not.

--
Pete
====
ECO Modeler, Audio compression components, DIB graphics controls,
FastStrings
http://www.droopyeyes.com

Read or write articles on just about anything
http://www.HowToDoThings.com

My blog
http://blogs.slcdug.org/petermorris/


David Clegg

unread,
Dec 8, 2005, 2:02:32 PM12/8/05
to
Sean Thomas wrote:

> Is there some way to force an object to refresh itself from the
> server EcoSpace?

As Pete said, the example in that article had it around the wrong way.
Below is a comment from my sync routine which was originally posted by
one of the ECO guys. Hopefully it will help to demystify how the
ChangeActionKind enumeration works.


/// <para>
/// ChangeActionKind.Ignore - Nothing happens when change is applied,
/// and the change is removed from the list of changes.
/// </para>
/// <para>
/// ChangeActionKind.Discard - Discard the cached copy in the EcoSpace,
/// so it will be re-fetched on demand from the persistence mechanism.
/// </para>
/// <para>
/// ChangeActionKind.Keep - Keep the cached copy in the EcoSpace, so a
/// subsequent update will overwrite the changes written to the
/// persistence mechanism
/// </para>
/// <para>
/// ChangeActionKind.Verify - Check the value of the element has really
/// changed. If it is the same, the element is removed from the list of
/// changes.
/// </para>
/// <para>
/// ChangeActionKind.Reread - Immediately fetch the new value from the
/// persistence mechanism.
/// </para>
/// <para>
/// ChangeActionKind.Undecided - Change cannot be applied. Calling
Apply
/// results in nothing happening and change remains in the list of
/// changes.
/// </para>
/// </summary>

> I only have Pascal examples of the server setup. Is there a C# one?

My server is in Delphi, but converting it to C# would be trivial. If
you are having trouble doing that, send your examples to me, or post
them here, and I can convert them for you*. :-)

*src := StringReplace(src, "begin", "{", [roReplaceAll, roIgnoreCase]);
src := StringReplace(src, "end", "}", [roReplaceAll, roIgnoreCase]);

:-)

--
Cheers,
David Clegg
dcl...@gmail.com
http://cc.borland.com/Author.aspx?ID=72299

QualityCentral. The best way to bug Borland about bugs.
http://qc.borland.com

"Being eaten by a crocodile is just like falling asleep, in a blender."
- Homer Simpson

Sean Thomas

unread,
Dec 8, 2005, 5:05:33 PM12/8/05
to
Hi Peter and David

The dog left the office after my response to discovering the folly of my
ways...

Thank you very much indeed. I have burnt some time on this...

The synchronisation is now working splendidly.

Kindest regards

Sean

0 new messages