DbConfiguration.SetModelCacheKey Method (Func<DbContext, IDbModelCacheKey>)
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.
Assembly: EntityFramework (in EntityFramework.dll)
Parameters
- keyFactory
-
Type:
System.Func<DbContext, IDbModelCacheKey>
The key factory.
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.