private void SetCacheState(MetadataProviderState newState) { if (this.cacheState < newState) { this.cacheState = newState; } }
private void SetMaterializationState(MetadataProviderState newState) { if (newState == MetadataProviderState.Incremental) { this.materializationState = MetadataProviderState.Incremental; } else if (this.materializationState < newState) { this.materializationState = newState; } }
/// <summary> /// Sets the current cache state of the metadata if the new state is /// greater than the existing state. /// </summary> /// <param name="newState">The new state to set.</param> /// <remarks> /// This method assumes that it is never called with the <paramref name="newState"/> /// being set to MetadataProviderState.Incremental. /// </remarks> private void SetCacheState(MetadataProviderState newState) { Debug.Assert(newState != MetadataProviderState.Incremental, "Should never set the cache state to 'Incremental'."); if (this.cacheState < newState) { this.cacheState = newState; } }
/// <summary> /// Checks whether a specified materialization state has been reached (or exceeded). /// </summary> /// <param name="state">The state that has to be reached.</param> /// <returns>true if the materialization state has reached the state specified in <paramref name="state"/>; otherwise false.</returns> private bool HasMaterializationState(MetadataProviderState state) { return this.materializationState >= state; }
/// <summary> /// Sets the current materialization state of the metadata if the new state is /// greater than the existing state. /// </summary> /// <param name="newState">The new state to set.</param> /// <remarks> /// This method assumes that it is never called with the <paramref name="newState"/> being the same as the current /// state. Nested calls in the same state are not allowed. /// </remarks> private void SetMaterializationState(MetadataProviderState newState) { Debug.Assert(this.materializationState != newState, "Nested calls of this method with the same state are not allowed."); if (newState == MetadataProviderState.Incremental) { // Reset the materialization state this.materializationState = MetadataProviderState.Incremental; } else if (this.materializationState < newState) { this.materializationState = newState; } }
/// <summary> /// First sets the materialization state, then runs the specified action and then /// resets the materialization state and checks the cache state. /// </summary> /// <param name="action">The action to run.</param> /// <param name="state">The <see cref="MetadataProviderState"/> to run the action in.</param> /// <remarks> /// The materialization is expected to be 'Incremental' when this method is called. /// The method should only be used in public API methods that are not re-entered by /// private/internal code since only public API code should set the materialization state. /// </remarks> private void RunInState(Action action, MetadataProviderState state) { Debug.Assert(action != null, "action != null"); Debug.Assert( this.materializationState == MetadataProviderState.Incremental, "No ongoing materialization code should call back into this public API"); this.SetMaterializationState(state); action(); this.SetMaterializationState(MetadataProviderState.Incremental); this.AssertCacheState(state); }
private void SetMaterializationState(MetadataProviderState newState) { if (newState == MetadataProviderState.Incremental) { this.materializationState = MetadataProviderState.Incremental; } else if (this.materializationState < newState) { this.materializationState = newState; } }
private void SetCacheState(MetadataProviderState newState) { if (this.cacheState < newState) { this.cacheState = newState; } }
internal void AssertMaterializationState(MetadataProviderState state) { }
internal void AssertMaterializationState(MetadataProviderState state) { }
internal void AssertCacheState(MetadataProviderState state) { }
private void RunInState(Action action, MetadataProviderState state) { this.SetMaterializationState(state); action(); this.SetMaterializationState(MetadataProviderState.Incremental); }
private bool HasMaterializationState(MetadataProviderState state) { return(this.materializationState >= state); }
private bool HasCacheState(MetadataProviderState state) { return(this.cacheState >= state); }
/// <summary> /// Checks whether a specified cache state has been reached (or exceeded). /// </summary> /// <param name="state">The state that has to be reached.</param> /// <returns>true if the cache state has reached the state specified in <paramref name="state"/>; otherwise false.</returns> private bool HasCacheState(MetadataProviderState state) { return this.cacheState >= state; }
private void RunInState(Action action, MetadataProviderState state) { this.SetMaterializationState(state); action(); this.SetMaterializationState(MetadataProviderState.Incremental); }
internal void AssertMaterializationState(MetadataProviderState state) { #if DEBUG Debug.Assert(state != MetadataProviderState.Incremental, "Should never attempt to assert the 'Incremental' state."); if (this.materializationState < state) { string message = string.Format( CultureInfo.InvariantCulture, "The current materialization state is '{0}' but expected at least '{1}'.", this.materializationState.ToString(), state.ToString()); Debug.Assert(false, message); } #endif }
internal void AssertCacheState(MetadataProviderState state) { }