DbConfiguration.SetModelCacheKey Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Call this method from the constructor of a class derived from DbConfiguration to set a Func<T,TResult> as the model cache key factory which allows the key used to cache the model behind a DbContext to be changed.
protected internal void SetModelCacheKey (Func<System.Data.Entity.DbContext,System.Data.Entity.Infrastructure.IDbModelCacheKey> keyFactory);
member this.SetModelCacheKey : Func<System.Data.Entity.DbContext, System.Data.Entity.Infrastructure.IDbModelCacheKey> -> unit
Protected Friend Sub SetModelCacheKey (keyFactory As Func(Of DbContext, IDbModelCacheKey))
Parameters
- keyFactory
- Func<DbContext,IDbModelCacheKey>
The key factory.
Remarks
This method is provided as a convenient and discoverable way to add configuration to the Entity Framework. Internally it works in the same way as using AddDependencyResolver to add an appropriate resolver for Func<T,TResult>. This means that, if desired, the same functionality can be achieved using a custom resolver or a resolver backed by an Inversion-of-Control container.
Applies to
Entity Framework