Changesets and Correlations
When working with client-side data editing, new rows are often created before they are saved to the database. At that point, database-generated values such as identity primary keys or rowversion values are not yet available. POCO DataSet uses a changeset-based roundtrip model to handle this scenario in a safe and deterministic way.
A newly created row does not yet have a database identity value, but it must still be tracked, sent to the backend, and later matched with the server response. Relying solely on primary keys is not possible until the row has been saved.
POCO DataSet introduces a special client-only column named “__ClientKey” to solve this problem. The client key does not replace primary keys; it exists only to correlate client and server rows during a save roundtrip. Each new row is assigned a unique Guid value when it is created on the client. The “__ClientKey” acts as a temporary, client-generated identifier that remains stable for the lifetime of the changeset roundtrip.
This approach keeps POCO DataSet independent of database identity strategies while still supporting robust merge behavior. It mirrors proven patterns used in enterprise data frameworks and offline-first systems, without introducing database-specific assumptions into the core data model.
Table of Content POCO DataSet Concepts
Business Process Programming in .Net
© 2004–2026 Laskarzhevsky Software Inc.
Unless otherwise noted, the content of this website is licensed under the
Creative Commons Attribution 4.0 International License (CC BY 4.0).
Code examples are provided under the MIT License.
You are free to share and adapt the material provided that appropriate
credit is given and any modifications are clearly indicated.
The information provided on this website is for educational purposes only.
The author and publisher make no warranties regarding the completeness
or suitability of the information and are not responsible for any damages
resulting from its use.