How to use INotifyPropertyChanged to update a list when the database is changed

StackOverflow https://stackoverflow.com/questions/23578913

  •  19-07-2023
  •  | 
  •  

Pergunta

I have a list( XPCollection) bound to a XPLiteObject (Attente) We work on a LAN, I'd like when the client (in the client app)change something in he database(CRUD operation) the list(XPCollection) for the server app should be updated(add the new rows if there is, and update data)

How to manage that?

I have tow app, the server one and the client one, the client app look for the SqlServer database and make change.

Foi útil?

Solução

XPO does not track changes made in the database. A possible workaround is to use the feature described in this blog: XPO Beta feature: SqlDependency support.

XPO does not expose SqlDependency notifications, so there is no way to track the exact moment when the changes were made. You can simply repeat queries in a small time interval. For example, execute the XPCollection.Reload method on every 1000th millisecond.

This will not impact the application performance, because XPO will return data from cache, without performing actual query to the SQL Server. However, when another user updates data, the query will be performed to update the cache. So, the data in the client application will always be up to date.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top