Question

How do you implement CRUD without changetracking?

Raised up in happy ADO.NET world, I'm wondering how CRUD operations are managed with POCOs without change tracking.
A common pattern for typical fat client solutions is to bind DataTables to controls and let the user manage the data by deleting, adding or modifying rows. Afterwards the data is written back into the database using one Save()command.
Working with POCOs, I saw that the most frameworks (like ServiceStack.ORMLite or PetaPoco) skip change tracking and I'm wondering how a robust pattern to work that POCOs might look like.
In complex business applications one cannot just send a Update X to Y command after another without using transactions etc. and I see no way to bundle changes into one single command after the user clicked on "save" for example.

Was it helpful?

Solution

Unless I'm mistaken, if you want to store up all the changes and then submit them on a "Save" command then you HAVE to have change tracking of some kind. Whether it is implemented with an ADO transaction or you roll your own Unit of Work pattern.

You can of course do CRUD operations without change tracking as you mentioned but the CRUD operations would have to be committed immediately.

If it was me I would look at the tools available (can you use Entity Framework for example?) - look at the need to actually track the changes and weigh up the development time it would take to implement a change tracking mechanism. You might find that just committing the CRUD operations immediately be the best option.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top