DatabaseExtensions Class

This class contains extension methods for database objects

Definition

Namespace: EWSoftware.EntityFramework
Assembly: EWSoftware.EntityFramework (in EWSoftware.EntityFramework.dll) Version: 2025.11.12.0
public static class DatabaseExtensions
Inheritance
Object    DatabaseExtensions

Properties

AsyncMethodSuffix This property is used to get or set the asynchronous method suffix that is automatically removed from method stored procedure names.
ResultSetSuffix This property is used to get or set the result set entity type suffix that is automatically removed from entity stored procedure names.

Methods

CheckAndUpdateKeysTEntity This extension method is used to check for null keys or incomplete rows added by controls and either remove them or update them based on the passed in delegate methods.
DeleteEntityTEntity Delete the given entity using a stored procedure defined on the entity type
DeleteEntityAsyncTEntity Delete the given entity asynchronously using a stored procedure defined on the entity type
ExecuteMethodNonQuery Execute a non-query stored procedure associated with a method on a data context and return the stored procedure's return value, number of rows affected, and optionally output parameter values.
ExecuteMethodNonQueryAsync Execute a non-query stored procedure associated with a method on a data context asynchronously and return the stored procedure's return value, number of rows affected, and optionally output parameter values.
ExecuteMethodQueryTEntity Execute a query stored procedure associated with a method on a data context and return the stored procedure's result set as an enumerable list of the given entity type.
ExecuteMethodQueryAsyncTEntity Execute a query stored procedure associated with a method on a data context and return the stored procedure's result set asynchronously as an enumerable list of the given entity type.
GetCommand This extension method is used to get a command object in a state ready to execute the specified command text on the given data context.
GetMethodInfo Get the method information for the calling method in the given data context type for use in a stored procedure method call.
HasChanges This extension method is used to see if a data context has any unsaved changes.
InsertEntityTEntity Insert the given entity using a stored procedure defined on the entity type
InsertEntityAsyncTEntity Insert the given entity asynchronously using a stored procedure defined on the entity type
LoadAllTEntity Load all entities of the given type using a stored procedure defined on the entity type
LoadAllAsyncTEntity Load all entities of the given type asynchronously using a stored procedure defined on the entity type
LoadByKeyTEntity Load all entities of the given type using a stored procedure defined on the entity type using the given key value(s).
LoadByKeyAsyncTEntity Load all entities of the given type asynchronously using a stored procedure defined on the entity type using the given key value(s).
NoTrackingT This extension method is used to turn off query tracking in a data context when constructed.
NullIfEmpty This is used to convert strings to null values if they are empty
NullIfWhiteSpace This is used to convert strings to null values if they are empty or all whitespace
OpenT This extension method is used to open a connection on a data context when constructed.
OpenAsyncT This extension method is used to open a connection on a data context asynchronously when constructed.
SubmitChangesTEntity(DbContext) 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.
SubmitChangesTEntity(DbContext, FuncEntityEntryTEntity, Boolean, FuncEntityEntryTEntity, Boolean, FuncEntityEntryTEntity, Boolean) Submit all tracked add, update, and delete changes for the given entity type using supplied functions that allow for custom handling of the operations.
SubmitChangesAsyncTEntity(DbContext, CancellationToken) Submit all tracked add, update, and delete changes asynchronously for the given entity type using the stored procedures defined on the entity type with the InsertEntityStoredProcedureAttribute, UpdateEntityStoredProcedureAttribute, and DeleteEntityStoredProcedureAttribute.
SubmitChangesAsyncTEntity(DbContext, FuncEntityEntryTEntity, TaskBoolean, FuncEntityEntryTEntity, TaskBoolean, FuncEntityEntryTEntity, TaskBoolean, CancellationToken) Submit all tracked add, update, and delete changes asynchronously for the given entity type using supplied functions that allow for custom handling of the operations.
ToChar This is used to convert a string value to a nullable Char by returning null if the string is null or empty or the first character of the string if not.
ToNullableT(Object) This is used to convert objects to null values if they are equal to null, DBNull.Value, or the default value for the given type.
ToNullableT(T) This is used to convert value types to null values if they are set to their default value for the type (i.e. zero for integers, DateTime.MinValue for date/times, etc).
ToStringOrNull This is used to convert an object to a string and return either the string value if not empty, or null if it is an empty string.
ToTrackingBindingListTEntity This converts an enumerable list of change tracking entities to a binding list that will notify the related data context of additions, changes, and deletions. The returned list is suitable for binding to Windows Forms controls.
ToTrackingCollectionTEntity This converts an enumerable list of change tracking entities to an observable collection that will notify the related data context of additions, changes, and deletions.
UpdateEntityTEntity Update the given entity using a stored procedure defined on the entity type
UpdateEntityAsyncTEntity Update the given entity asynchronously using a stored procedure defined on the entity type

See Also