You can achieve this with the Flush() method of the internal object scope that the context instance is using. In order to use it, you will have to extend your context with another partial class (with the same name) and expose the internal Flush method. This would look like this:
Then you could do the following:
The Flush method would start a transaction on the database server and execute the actions performed so far in the OpenAccess transaction (without committing the transaction, everything can still be rolled back). This means that if there is a conflict with a constraint, the database server would throw an error, which you could handle.
Please just note that once a transaction is open on the database side, it has a timeout (by default 120 seconds) and if you do not commit or roll it back by that time, you would get an exception. If you experience such problems, you could increase the connection timeout from the backend configuration.
I hope that helps.
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward!
We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>