public static ILoggingBuilder AddEntityFramework <TContext>(this ILoggingBuilder builder, Action <DbLoggerOptions> configuration) where TContext : DbContext { builder.AddEntityFramework <TContext>(); builder.Services.Configure(configuration); return(builder); }
/// <summary> /// Adds a entity framework logger named 'EntityFramework' to the factory. /// </summary> /// <param name="builder"> /// The <see cref="ILoggingBuilder"/> to use. /// </param> /// <param name="configure"> /// The <see cref="ILoggingBuilder"/> configuration delegate. /// </param> /// <typeparam name="TContext"> /// The type of the data context class used to access the store. /// </typeparam> public static ILoggingBuilder AddEntityFramework <TContext>(this ILoggingBuilder builder, Action <EntityFrameworkLoggerOptions> configure) where TContext : DbContext { if (configure == null) { throw new ArgumentNullException(nameof(configure)); } builder.AddEntityFramework <TContext>(); builder.Services.Configure(configure); return(builder); }
/// <summary> /// Adds a entity framework logger named 'EntityFramework' to the factory. /// </summary> /// <param name="builder"> /// The <see cref="ILoggingBuilder"/> to use. /// </param> /// <param name="configure"> /// The <see cref="ILoggingBuilder"/> configuration delegate. /// </param> /// <typeparam name="TContext"> /// The type of the data context class used to access the store. /// </typeparam> /// <typeparam name="TLog"> /// The type representing a log. /// </typeparam> /// <typeparam name="TLogger"> /// The type of the entity framework logger class used to log. /// </typeparam> /// <typeparam name="TKey"> /// The type of the primary key for a log. /// </typeparam> public static ILoggingBuilder AddEntityFramework <TContext, TLog, TLogger, TKey>( this ILoggingBuilder builder, Action <EntityFrameworkLoggerOptions <TLog> > configure) where TContext : DbContext where TLog : Log <TKey> where TLogger : EntityFrameworkLogger <TContext, TLog, TKey> where TKey : IEquatable <TKey> { if (configure == null) { throw new ArgumentNullException(nameof(configure)); } builder.AddEntityFramework <TContext, TLog, TLogger, TKey>(); builder.Services.Configure(configure); return(builder); }