/// <summary> /// Registers Serilog with the logging facility. /// </summary> /// <param name="builder">The <see cref="IFacilityBuilder{TFacility}"/>.</param> /// <param name="configure">The delegate which is invoked to configure the extension.</param> /// <returns>The <paramref name="builder"/>.</returns> public static IFacilityBuilder <ILoggingFacility> AddSerilog( this IFacilityBuilder <ILoggingFacility> builder, Action <IFacilityExtensionBuilder <ILoggingFacility, SerilogLoggingExtension> > configure = null) { Ensure.Arg.NotNull(builder, nameof(builder)); return(builder.Add(configure)); }
AddEntityFrameworkCore <TTag, TDbContext>( this IFacilityBuilder <IDataFacility> builder, Action <IEntityFrameworkCoreExtensionBuilder <TTag, TDbContext> > configure = null) where TDbContext : DbContext { return(builder.Add <EntityFrameworkCoreExtension <TTag, TDbContext> >( c => { configure?.Invoke(new EntityFrameworkCoreExtensionBuilder <TTag, TDbContext>(c)); })); }
/// <summary> /// Adds startup tasks to the container. /// </summary> /// <param name="builder">The <see cref="IFacilityBuilder{TFacility}"/>.</param> /// <param name="registrationBuilder">A delegate to configure the <see cref="IRegistrationBuilder{TContract}"/>.</param> /// <returns>The <paramref name="builder"/>.</returns> /// <exception cref="ArgumentNullException">Argument <paramref name="builder"/> is <c>null</c>.</exception> public static IFacilityBuilder <IHostingFacility> AddStartupTasks( this IFacilityBuilder <IHostingFacility> builder, Action <IRegistrationBuilder <IStartupTask> > registrationBuilder) { Ensure.Arg.NotNull(builder, nameof(builder)); return(builder.Add( new RegistrationFacilityExtension <IHostingFacility, IStartupTask>( (r, f) => { r.WithDefaultLifetime(ComponentLifetime.Transient); registrationBuilder(r); }))); }
/// <summary> /// Registers the Microsoft Logging with the logging facility. /// </summary> /// <param name="builder">The <see cref="IFacilityBuilder{TFacility}"/>.</param> /// <param name="configure">The delegate which is invoked to configure the extension.</param> /// <returns>The <paramref name="builder"/>.</returns> public static IFacilityBuilder <ILoggingFacility> UseMicrosoftExtensions( this IFacilityBuilder <ILoggingFacility> builder) { Ensure.Arg.NotNull(builder, nameof(builder)); return(builder.Add <MicrosoftLoggingExtension>()); }
/// <summary> /// Registers adapters for Microsoft.Extensions.Hosting. /// </summary> /// <param name="builder"></param> /// <returns></returns> public static IFacilityBuilder <IHostingFacility> UseMicrosoftExtensions( this IFacilityBuilder <IHostingFacility> builder) { return(builder.Add <MicrosoftHostingExtension>()); }