Silverlight Feeds - All your Silverlight feeds in one place.

Sponsors

Saturday, January 09, 2010

EntitiesInError in WCF RIA Services

by Corrado Cavalli via Corrado's BLogs on 1/9/2010 3:25:31 PM

Gestire situazioni in cui si hanno problemi di concorrenza tra utenti con i WCF RIA Services è veramente molto semplice, supponiamo di voler sapere se durante un operazione di update qualcuno ha modificato prima di noi gli stessi records.
Il codice da scrivere è il seguente:

private void OnUpdate(object sender, RoutedEventArgs e)
{
 this.customersContext.SubmitChanges(lop =>
    {
       if(lop.HasError)
       {
          MessageBox.Show(lop.EntitiesInError.Count().ToString());
       }
 
    }, null);
}

Quello che è importante conoscere dello snippet sopra indicato è che il contenuto della proprietà EntitiesInError cambia a seconda del provider di accesso ai dati e da come questo gestisce la unit-of-work.
Se utilizzate Entity Framework, indipendentemente dai records effettivamente in conflitto otterrete sempre 1, mentre se utilizzate il tanto ‘denigrato’ LinqToSQL otterrete il numero corretto.

Technorati Tags: ,
email it!bookmark it!digg it!

Original Post: EntitiesInError in WCF RIA Services

Subscribe

New Feed

Product Spotlight

Recently Updated Sources

Legal Note

The content of the postings is owned by the respective author. Silverlight Feeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on Silverlight Feeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.

Advertise with us