DbContext Methods

The DbContext type exposes the following members.

  Name Description
Public method Dispose() Calls the protected Dispose method.
Protected method Dispose(Boolean) Disposes the context. The underlying ObjectContext is also disposed if it was created is by this context or ownership was passed to this context when this context was created. The connection to the database (DbConnection object) is also disposed if it was created is by this context or ownership was passed to this context when this context was created.
Public method Entry(Object) Gets a DbEntityEntry object for the given entity providing access to information about the entity and the ability to perform actions on the entity.
Public method Entry<TEntity>(TEntity) Gets a DbEntityEntry<TEntity> object for the given entity providing access to information about the entity and the ability to perform actions on the entity.
Public method Equals Returns whether the specified context is equal to the current context. (Overrides Object.Equals(Object).)
Protected method Finalize (Inherited from Object.)
Public method GetHashCode Returns the hash function for the specified context. (Overrides Object.GetHashCode().)
Public method GetType Gets the type for the current context.
Public method GetValidationErrors Validates tracked entities and returns a Collection of DbEntityValidationResult containing validation results.
Protected method MemberwiseClone (Inherited from Object.)
Protected method OnModelCreating This method is called when the model for a derived context has been initialized, but before the model has been locked down and used to initialize the context. The default implementation of this method does nothing, but it can be overridden in a derived class such that the model can be further configured before it is locked down.
Public method SaveChanges Saves all changes made in this context to the underlying database.
Public method Set(Type) Returns a DbSet for the specified type, this allows CRUD operations to be performed for the given entity in the context.
Public method Set<TEntity>() Returns a DbSet for the specified type, this allows CRUD operations to be performed for the given entity in the context.
Protected method ShouldValidateEntity Extension point allowing the user to override the default behavior of validating only added and modified entities.
Public method ToString Returns a string representation of the context. (Overrides Object.ToString().)
Protected method ValidateEntity Extension point allowing the user to customize validation of an entity or filter out validation results. Called by GetValidationErrors().
Top
Show: