/// <summary>
 ///     <para>
 ///         Prevents conventions from being executed immediately when a metadata aspect is modified. All the delayed conventions
 ///         will be executed after the returned object is disposed.
 ///     </para>
 ///     <para>
 ///         This is useful when performing multiple operations that depend on each other.
 ///     </para>
 /// </summary>
 /// <returns>An object that should be disposed to execute the delayed conventions.</returns>
 public virtual IConventionBatch DelayConventions()
 => _dispatcher.DelayConventions();
        public IConventionModelBuilder OnModelFinalizing(IConventionModelBuilder modelBuilder)
        {
            _modelBuilderConventionContext.ResetState(modelBuilder);
            foreach (var modelConvention in _conventionSet.ModelFinalizingConventions)
            {
                // Execute each convention in a separate batch so each will get an up-to-date model as they are meant to be only run once
                using (_dispatcher.DelayConventions())
                {
                    modelConvention.ProcessModelFinalizing(modelBuilder, _modelBuilderConventionContext);
                    if (_modelBuilderConventionContext.ShouldStopProcessing())
                    {
                        return(_modelBuilderConventionContext.Result !);
                    }
                }
            }

            return(modelBuilder);
        }