Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1115
Fix added rows before saving
posted

In one application I need to assing an ID to each added row before saving to the domaindatasource, in another I want to backup any deleted rows before saving.

What is the syntax in c# to iterate through the rows to check if they have been added or deleted before saving?

 

  • 8421
    Suggested Answer
    posted

    A better approach might be to do this when the DomainDataSource is submitting its changes. You could handle the SubmittingChanges event of the DomainDataSource and then use the ChangeSet property of its event args. This is of type EntityChangeSet and exposes the AddedEntities and RemovedEntities. Using these collections you could iterate through them and either set the ID on AddedEntities or store the DeletedEntities.