/// <summary> /// Sets the <see cref="ICacheWithStatistics"/> implementation for given object context. /// </summary> /// <param name="context">The object context.</param> /// <param name="cache">The cache.</param> public static void SetCache(this ObjectContext context, IEntityFrameworkCache cache) { if (context == null) { throw new ArgumentNullException("context"); } SetCache(context.Connection, cache); }
public CachedContextConnectionFactory( IEntityFrameworkCache cache, string providerName = "System.Data.SqlClient") { if (cache == null) { throw new ArgumentNullException("cache"); } if (providerName == null) { throw new ArgumentNullException("providerName"); } this.cache = cache; this.providerName = providerName; }
/// <summary> /// Sets the <see cref="ICacheWithStatistics"/> implementation for given connection. /// </summary> /// <param name="connection">The connection.</param> /// <param name="cache">The cache.</param> public static void SetCache(this DbConnection connection, IEntityFrameworkCache cache) { connection.UnwrapConnection<CachingConnection>().Cache = cache; }
public CachedDbConfiguration(IEntityFrameworkCache entityFrameworkCache) { SetDefaultConnectionFactory(new CachedContextConnectionFactory(entityFrameworkCache)); }