The code that you have posted has some flaws that cause the connection timeout and can lead to more serious problems with transactions and locking when more concurrent users start to use your application.
should be avoided especially if the time period between FlushChanges
depends on user actions and can not be safely minimized. The reason is that FlushChanges
will start a database transaction and this transaction will remain active and open until SaveChanges
is called. Setting the connection timeout will not solve the problem
in this case.
In addition you should be careful when calling MoveLast
since this method can return not your new object but another one that is added by another concurrent user.
If you are using the ObjectProvider
to bind single item controls (like combobox or textbox and etc) I would suggest that you bind them manually in the Form_Loaded
If you want to bind a data grid or list you can use the ObjectProvider
or Bindling Source
You can download OpenAccess Samples Kit
to see an example how to use BindingSource
component to bind a RadGrid
class) and how to bind data for single entity (see CarInfoView
If you need any further assistance, please let us know.
All the best,
the Telerik team