/// <inheritdoc /> public override DbContextOptions WithExtension <TExtension>(TExtension extension) { Check.NotNull(extension, nameof(extension)); return(new DbContextOptions <TContext>(ExtensionsMap.SetItem(extension.GetType(), extension))); }
/// <summary> /// Gets the extension of the specified type. Returns <see langword="null" /> if no extension of the specified type is configured. /// </summary> /// <typeparam name="TExtension"> The type of the extension to get. </typeparam> /// <returns> The extension, or <see langword="null" /> if none was found. </returns> public virtual TExtension?FindExtension <TExtension>() where TExtension : class, IDbContextOptionsExtension => ExtensionsMap.TryGetValue(typeof(TExtension), out var extension) ? (TExtension)extension : null;