Synchronize DomainContext in multiple clients

2 posts, 0 answers
  1. Jacek
    Jacek avatar
    6 posts
    Member since:
    Dec 2012

    Posted 25 Jan 2013 Link to this post

    I am designing application in Silverlight 5 with WCF RIA Services and Telerik OA ORM.

    I can not find a way to automatically refresh the data for all clients currently connected.

    I show this on example

    This is grid where I binding data:

    <sdk:DataGrid AutoGenerateColumns="False" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" x:Name="grid">
            <sdk:DataGridTextColumn MinWidth="79" Header="ID" IsReadOnly="True" Binding="{Binding Id}"  />
            <sdk:DataGridTextColumn MinWidth="150" Header="Name" Binding="{Binding User_name}"  />

    This is fragment code-behind

    private DomainContext context = new DomainContext();
    private function void LoadContractors()
        LoadOperation<Contractor> contractors = context.Load<Contractor>(context.GetContractorsQuery());
        contractors.Completed += (s, args) =>
            grid.ItemsSource = contractors.Entities;

    Problems begin when more than one client is connected.

    1. Client1 and Client2 are connected and working at the same time
    2. Client1 made changes and run context.CommitChanges()
    3. Client2 doesn't see the changes. If the Client2 will be edited the same record like Client1, he will receive an error:

    Submit operation failed due to conflicts. Please inspect Entity.EntityConfilct for each entity in EntitiesInError for more information

    To solve this problem I created buttonRefresh, When the error occurs Client must load new data.

    private function void RefreshContractors()
        this.context = new DomainContext();

    My question is:

    Is there another solution, so that after editing the data in one client, changes immediately appear in another client? Is it possible to set OpenAcces to synchronize contexts for clients or if not, can all clients work in the same DomainContext?

  2. Damyan Bogoev
    Damyan Bogoev avatar
    581 posts

    Posted 28 Jan 2013 Link to this post

    Hi Jacek,

    I am afraid that you need to implement custom handling for syncing the data in your Silverlight application. Actually you could find this blog post helpful. It demonstrates how to handle similar scenario.

    Hope that helps.

    All the best,
    Damyan Bogoev
    the Telerik team
    Q3'12 SP1 of OpenAccess ORM packs Multi-Table Entities mapping support. Check it out.
  3. DevCraft banner
Back to Top