/// <summary> /// Determines whether the specified command definition can be cached. /// </summary> /// <param name="commandDefinition">The command definition.</param> /// <returns> /// A value of <c>true</c> if the specified command definition can be cached; otherwise, <c>false</c>. /// </returns> protected internal override bool CanBeCached(EFCachingCommandDefinition commandDefinition) { if (commandDefinition == null) { throw new ArgumentNullException("commandDefinition"); } // check if we have any non-cacheable tables in the query if (this.NonCacheableTables.Count > 0) { foreach (EntitySetBase esb in commandDefinition.AffectedEntitySets) { if (this.NonCacheableTables.Contains(esb.Name)) { return false; } } } // by default everything is cacheable if (this.CacheableTables.Count == 0) { return true; } else { // unless the user has explicitly specified which tables to cache foreach (EntitySetBase esb in commandDefinition.AffectedEntitySets) { if (!this.CacheableTables.Contains(esb.Name)) { return false; } } return true; } }
/// <summary> /// Determines whether the specified command definition can be cached. /// </summary> /// <param name="commandDefinition">The command definition.</param> /// <returns> /// A value of <c>true</c> if the specified command definition can be cached; otherwise, <c>false</c>. /// </returns> protected internal override bool CanBeCached(EFCachingCommandDefinition commandDefinition) { if (commandDefinition == null) { throw new ArgumentNullException("commandDefinition"); } // check if we have any non-cacheable tables in the query if (this.NonCacheableTables.Count > 0) { foreach (EntitySetBase esb in commandDefinition.AffectedEntitySets) { if (this.NonCacheableTables.Contains(esb.Name)) { return(false); } } } // by default everything is cacheable if (this.CacheableTables.Count == 0) { return(true); } else { // unless the user has explicitly specified which tables to cache foreach (EntitySetBase esb in commandDefinition.AffectedEntitySets) { if (!this.CacheableTables.Contains(esb.Name)) { return(false); } } return(true); } }
/// <summary> /// Gets the minimum and maximum number cacheable rows for a given command definition. /// </summary> /// <param name="cachingCommandDefinition">The command definition.</param> /// <param name="minCacheableRows">The minimum number of cacheable rows.</param> /// <param name="maxCacheableRows">The maximum number of cacheable rows.</param> protected internal override void GetCacheableRows(EFCachingCommandDefinition cachingCommandDefinition, out int minCacheableRows, out int maxCacheableRows) { minCacheableRows = 0; maxCacheableRows = -1; }
/// <summary> /// Determines whether the specified command definition can be cached. /// </summary> /// <param name="commandDefinition">The command definition.</param> /// <returns> /// A value of <c>true</c> if the specified command definition can be cached; otherwise, <c>false</c>. /// </returns> protected internal override bool CanBeCached(EFCachingCommandDefinition commandDefinition) { return false; }
/// <summary> /// Gets the expiration timeout for a given command definition. /// </summary> /// <param name="cachingCommandDefinition">The command definition.</param> /// <param name="slidingExpiration">The sliding expiration time.</param> /// <param name="absoluteExpiration">The absolute expiration time.</param> protected internal virtual void GetExpirationTimeout(EFCachingCommandDefinition cachingCommandDefinition, out TimeSpan slidingExpiration, out DateTime absoluteExpiration) { slidingExpiration = TimeSpan.Zero; absoluteExpiration = DateTime.MaxValue; }
/// <summary> /// Gets the minimum and maximum number cacheable rows for a given command definition. /// </summary> /// <param name="cachingCommandDefinition">The command definition.</param> /// <param name="minCacheableRows">The minimum number of cacheable rows.</param> /// <param name="maxCacheableRows">The maximum number of cacheable rows.</param> protected internal abstract void GetCacheableRows(EFCachingCommandDefinition cachingCommandDefinition, out int minCacheableRows, out int maxCacheableRows);
/// <summary> /// Determines whether the specified command definition can be cached. /// </summary> /// <param name="commandDefinition">The command definition.</param> /// <returns> /// A value of <c>true</c> if the specified command definition can be cached; otherwise, <c>false</c>. /// </returns> protected internal abstract bool CanBeCached(EFCachingCommandDefinition commandDefinition);
/// <summary> /// Initializes a new instance of the DbCommandWrapperExtended class. /// </summary> /// <param name="wrappedCommand">The wrapped command.</param> /// <param name="definition">The command definition.</param> public DbCommandWrapperExtended(System.Data.Common.DbCommand wrappedCommand, EFCachingCommandDefinition definition) : base(wrappedCommand, definition) { }
/// <summary> /// Gets the minimum and maximum number cacheable rows for a given command definition. /// </summary> /// <param name="cachingCommandDefinition">The command definition.</param> /// <param name="minCacheableRows">The minimum number of cacheable rows.</param> /// <param name="maxCacheableRows">The maximum number of cacheable rows.</param> protected internal override void GetCacheableRows(EFCachingCommandDefinition cachingCommandDefinition, out int minCacheableRows, out int maxCacheableRows) { minCacheableRows = this.MinCacheableRows; maxCacheableRows = this.MaxCacheableRows; }
/// <summary> /// Initializes a new instance of the <see cref="DbCommandWrapper"/> class. /// </summary> /// <param name="wrappedCommand">The wrapped command.</param> /// <param name="definition">The definition.</param> public DbCommandWrapper(System.Data.Common.DbCommand wrappedCommand, EFCachingCommandDefinition definition) { this.wrappedCommand = wrappedCommand; this.definition = definition; }
/// <summary> /// Determines whether the specified command definition can be cached. /// </summary> /// <param name="commandDefinition">The command definition.</param> /// <returns> /// A value of <c>true</c> if the specified command definition can be cached; otherwise, <c>false</c>. /// </returns> protected internal override bool CanBeCached(EFCachingCommandDefinition commandDefinition) { return(false); }
/// <summary> /// Gets the expiration timeout for a given command definition. /// </summary> /// <param name="cachingCommandDefinition">The command definition.</param> /// <param name="slidingExpiration">The sliding expiration time.</param> /// <param name="absoluteExpiration">The absolute expiration time.</param> protected internal virtual void GetExpirationTimeout(EFCachingCommandDefinition cachingCommandDefinition, out TimeSpan slidingExpiration, out DateTime absoluteExpiration) { slidingExpiration = TimeSpan.Zero; absoluteExpiration = DateTime.MaxValue; }
/// <summary> /// Gets the minimum and maximum number cacheable rows for a given command definition. /// </summary> /// <param name="cachingCommandDefinition">The command definition.</param> /// <param name="minCacheableRows">The minimum number of cacheable rows.</param> /// <param name="maxCacheableRows">The maximum number of cacheable rows.</param> protected internal abstract void GetCacheableRows(EFCachingCommandDefinition cachingCommandDefinition, out int minCacheableRows, out int maxCacheableRows);
/// <summary> /// Determines whether the specified command definition can be cached. /// </summary> /// <param name="commandDefinition">The command definition.</param> /// <returns> /// A value of <c>true</c> if the specified command definition can be cached; otherwise, <c>false</c>. /// </returns> protected internal abstract bool CanBeCached(EFCachingCommandDefinition commandDefinition);
/// <summary> /// Gets the minimum and maximum number cacheable rows for a given command definition. /// </summary> /// <param name="cachingCommandDefinition">The command definition.</param> /// <param name="minCacheableRows">The minimum number of cacheable rows.</param> /// <param name="maxCacheableRows">The maximum number of cacheable rows.</param> protected internal override void GetCacheableRows(EFCachingCommandDefinition cachingCommandDefinition, out int minCacheableRows, out int maxCacheableRows) { minCacheableRows = 0; maxCacheableRows = Int32.MaxValue; }