Database ExtensionsSubmit ChangesTEntity(DbContext) Method
Submit all tracked add, update, and delete changes for the given entity type using the stored
procedures defined on the entity type with the InsertEntityStoredProcedureAttribute,
UpdateEntityStoredProcedureAttribute, and DeleteEntityStoredProcedureAttribute.
Definition
Namespace: EWSoftware.EntityFramework
Assembly: EWSoftware.EntityFramework (in EWSoftware.EntityFramework.dll) Version: 2025.11.12.0
Assembly: EWSoftware.EntityFramework (in EWSoftware.EntityFramework.dll) Version: 2025.11.12.0
C#
public static void SubmitChanges<TEntity>(
this DbContext dataContext
)
where TEntity : class, INotifyPropertyChanged
VB
<ExtensionAttribute>
Public Shared Sub SubmitChanges(Of TEntity As {Class, INotifyPropertyChanged}) (
dataContext As DbContext
)C++
public:
[ExtensionAttribute]
generic<typename TEntity>
where TEntity : ref class, INotifyPropertyChanged
static void SubmitChanges(
DbContext^ dataContext
)F#
[<ExtensionAttribute>]
static member SubmitChanges :
dataContext : DbContext -> unit when 'TEntity : not struct and INotifyPropertyChangedParameters
- dataContext DbContext
- The data context to use for the operations
Type Parameters
- TEntity
- The entity type for which to submit changes
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type DbContext. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).Remarks
This will get the changed entities from the data context's change tracker and submit them
accordingly. The state of the entities is also updated to reflect that they are in an unchanged
state after being added or updated or detached if deleted. If the connection is not in an open
state, it is opened temporarily while performing the actions.
Example
C#
if(dataContext.HasChanges())
dataContext.SubmitChanges<Account>();