This project is read-only.

Clarify Persist() behavior

Nov 4, 2010 at 1:08 AM
Suppose we have a collection with 1,000 customers. The FirstName for one customer is updated. Now the customer collection is dirty. What does Persist() do? Does it save 1,000 customers to the database or does it save 1 customer to the database?
Nov 4, 2010 at 6:36 PM

The Persist action only saves "dirty" records. So only 1 record in this case would be saved. It does save the whole record though (all fields). There is a stored procedure under it that takes the parameters (all fields) in and saves that one record by primary key.

Nov 4, 2010 at 9:03 PM

Thank you. You answered my questions perfectly. I'm glad it saves the "dirty" record(s) only. Saving the entire record vs saving a specific field is the tradeoff I'm willing to make to use nHydrate out-of-the-box.

Nov 5, 2010 at 3:50 PM

Saving single fields would most likely require dynamic SQL generation and not stored procs. We have tried to use stored procs for several reasons; however the custom select syntax will generate dynamic SQL.