/// <summary> /// Uses the application domain. /// </summary> /// <param name="builder">The builder.</param> /// <param name="appDomain">The application domain.</param> /// <param name="diagnosticSource">The diagnostic source.</param> /// <returns>IRocketFunctionHostBuilder.</returns> public static IRocketFunctionHostBuilder UseAppDomain( this IRocketFunctionHostBuilder builder, AppDomain appDomain, DiagnosticSource diagnosticSource = null) { return(RocketBooster.ForAppDomain(appDomain, diagnosticSource)(builder.Builder, builder.FunctionsAssembly)); }
/// <summary> /// Uses the assemblies. /// </summary> /// <param name="builder">The builder.</param> /// <param name="assemblies">The assemblies.</param> /// <param name="diagnosticSource">The diagnostic source.</param> /// <returns>IRocketFunctionHostBuilder.</returns> public static IRocketFunctionHostBuilder UseAssemblies( this IRocketFunctionHostBuilder builder, IEnumerable <Assembly> assemblies, DiagnosticSource diagnosticSource = null) { return(RocketBooster.ForAssemblies(assemblies, diagnosticSource)(builder.Builder, builder.FunctionsAssembly)); }
/// <summary> /// Uses the dependency context. /// </summary> /// <param name="builder">The builder.</param> /// <param name="dependencyContext">The dependency context.</param> /// <param name="diagnosticSource">The diagnostic source.</param> /// <returns>IRocketFunctionHostBuilder.</returns> public static IRocketFunctionHostBuilder UseDependencyContext( this IRocketFunctionHostBuilder builder, DependencyContext dependencyContext, DiagnosticSource diagnosticSource = null) { return(RocketBooster.ForDependencyContext(dependencyContext, diagnosticSource)(builder.Builder, builder.FunctionsAssembly)); }
/// <summary> /// Uses the diagnostic logging. /// </summary> /// <param name="builder">The builder.</param> /// <param name="action">The action.</param> /// <returns>IRocketHostBuilder.</returns> public static IRocketFunctionHostBuilder UseDiagnosticLogging( [NotNull] this IRocketFunctionHostBuilder builder, [NotNull] Action <ILoggingBuilder> action ) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (action == null) { throw new ArgumentNullException(nameof(action)); } (builder.DiagnosticSource is DiagnosticListener listener ? listener : new DiagnosticListener("DiagnosticLogger")).SubscribeWithAdapter( new DiagnosticListenerLoggingAdapter( new ServiceCollection() .AddLogging(action) .BuildServiceProvider() .GetRequiredService <ILoggerFactory>() .CreateLogger("DiagnosticLogger") ) ); return(builder); }
/// <summary> /// Swaps the specified builder. /// </summary> /// <param name="builder">The builder.</param> /// <param name="newRocketFunctionBuilder">The new rocket function builder.</param> /// <returns>RocketFunctionHostBuilder.</returns> internal static RocketFunctionHostBuilder Swap( IRocketFunctionHostBuilder builder, RocketFunctionHostBuilder newRocketFunctionBuilder ) { Builders.Remove(builder.Builder); Builders.Add(builder.Builder, newRocketFunctionBuilder); return(newRocketFunctionBuilder); }
/// <summary> /// Uses the assembly provider. /// </summary> /// <param name="builder">The builder.</param> /// <param name="assemblyProvider">The assembly provider.</param> /// <returns>IRocketFunctionHostBuilder.</returns> public static IRocketFunctionHostBuilder UseAssemblyProvider( [NotNull] this IRocketFunctionHostBuilder builder, [NotNull] IAssemblyProvider assemblyProvider ) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (assemblyProvider == null) { throw new ArgumentNullException(nameof(assemblyProvider)); } return(Swap(builder, GetOrCreateBuilder(builder, builder.FunctionsAssembly, null).With(assemblyProvider))); }
/// <summary> /// Uses the environment. /// </summary> /// <param name="builder">The builder.</param> /// <param name="environment">The environment.</param> /// <returns>IRocketFunctionHostBuilder.</returns> public static IRocketFunctionHostBuilder UseEnvironment( [NotNull] this IRocketFunctionHostBuilder builder, [NotNull] IRocketEnvironment environment ) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (environment == null) { throw new ArgumentNullException(nameof(environment)); } return(Swap(builder, GetOrCreateBuilder(builder, builder.FunctionsAssembly, null).With(environment))); }
/// <summary> /// Uses the diagnostic source. /// </summary> /// <param name="builder">The builder.</param> /// <param name="diagnosticSource">The diagnostic source.</param> /// <returns>IRocketFunctionHostBuilder.</returns> public static IRocketFunctionHostBuilder UseDiagnosticSource( [NotNull] this IRocketFunctionHostBuilder builder, [NotNull] DiagnosticSource diagnosticSource ) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (diagnosticSource == null) { throw new ArgumentNullException(nameof(diagnosticSource)); } return(Swap(builder, GetOrCreateBuilder(builder, builder.FunctionsAssembly, null).With(diagnosticSource))); }
/// <summary> /// Uses the application domain. /// </summary> /// <param name="builder">The builder.</param> /// <param name="appDomain">The application domain.</param> /// <param name="diagnosticSource">The diagnostic source.</param> /// <returns>IRocketFunctionHostBuilder.</returns> public static IRocketFunctionHostBuilder UseAppDomain( [NotNull] this IRocketFunctionHostBuilder builder, [NotNull] AppDomain appDomain, DiagnosticSource?diagnosticSource = null ) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (appDomain == null) { throw new ArgumentNullException(nameof(appDomain)); } return(RocketBooster.ForAppDomain(appDomain, diagnosticSource)(builder.Builder, builder.FunctionsAssembly)); }
/// <summary> /// Uses the assemblies. /// </summary> /// <param name="builder">The builder.</param> /// <param name="assemblies">The assemblies.</param> /// <param name="diagnosticSource">The diagnostic source.</param> /// <returns>IRocketFunctionHostBuilder.</returns> public static IRocketFunctionHostBuilder UseAssemblies( [NotNull] this IRocketFunctionHostBuilder builder, [NotNull] IEnumerable <Assembly> assemblies, DiagnosticSource?diagnosticSource = null ) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (assemblies == null) { throw new ArgumentNullException(nameof(assemblies)); } return(RocketBooster.ForAssemblies(assemblies, diagnosticSource)( builder.Builder, builder.FunctionsAssembly )); }
/// <summary> /// Uses the dependency context. /// </summary> /// <param name="builder">The builder.</param> /// <param name="dependencyContext">The dependency context.</param> /// <param name="diagnosticSource">The diagnostic source.</param> /// <returns>IRocketFunctionHostBuilder.</returns> public static IRocketFunctionHostBuilder UseDependencyContext( [NotNull] this IRocketFunctionHostBuilder builder, [NotNull] DependencyContext dependencyContext, DiagnosticSource?diagnosticSource = null ) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (dependencyContext == null) { throw new ArgumentNullException(nameof(dependencyContext)); } return(RocketBooster.ForDependencyContext(dependencyContext, diagnosticSource)( builder.Builder, builder.FunctionsAssembly )); }
/// <summary> /// Uses the scanner. /// </summary> /// <param name="builder">The builder.</param> /// <param name="scanner">The scanner.</param> /// <returns>IRocketFunctionHostBuilder.</returns> public static IRocketFunctionHostBuilder UseScanner(this IRocketFunctionHostBuilder builder, IConventionScanner scanner) { return(Swap(builder, GetOrCreateBuilder(builder, builder.FunctionsAssembly, null).With(scanner))); }
/// <summary> /// Gets the or create builder. /// </summary> /// <param name="builder">The builder.</param> /// <param name="startupInstance">The startup instance.</param> /// <param name="environment">The environment.</param> /// <returns>RocketFunctionHostBuilder.</returns> internal static RocketFunctionHostBuilder GetOrCreateBuilder( IRocketFunctionHostBuilder builder, object startupInstance, IRocketEnvironment?environment ) => GetOrCreateBuilder(builder.Builder, startupInstance, environment);
/// <summary> /// Uses the assembly provider. /// </summary> /// <param name="builder">The builder.</param> /// <param name="assemblyProvider">The assembly provider.</param> /// <returns>IRocketFunctionHostBuilder.</returns> public static IRocketFunctionHostBuilder UseAssemblyProvider(this IRocketFunctionHostBuilder builder, IAssemblyProvider assemblyProvider) { return(Swap(builder, GetOrCreateBuilder(builder, builder.FunctionsAssembly, null).With(assemblyProvider))); }
/// <summary> /// Uses the functions assembly. /// </summary> /// <param name="builder">The builder.</param> /// <param name="assembly">The assembly.</param> /// <returns>IRocketFunctionHostBuilder.</returns> public static IRocketFunctionHostBuilder UseFunctionsAssembly(this IRocketFunctionHostBuilder builder, Assembly assembly) { return(Swap(builder, GetOrCreateBuilder(builder, builder.FunctionsAssembly, null).With(assembly))); }
/// <summary> /// Uses the diagnostic source. /// </summary> /// <param name="builder">The builder.</param> /// <param name="diagnosticSource">The diagnostic source.</param> /// <returns>IRocketFunctionHostBuilder.</returns> public static IRocketFunctionHostBuilder UseDiagnosticSource(this IRocketFunctionHostBuilder builder, DiagnosticSource diagnosticSource) { return(Swap(builder, GetOrCreateBuilder(builder, builder.FunctionsAssembly, null).With(diagnosticSource))); }
/// <summary> /// Uses the environment. /// </summary> /// <param name="builder">The builder.</param> /// <param name="environment">The environment.</param> /// <returns>IRocketFunctionHostBuilder.</returns> public static IRocketFunctionHostBuilder UseEnvironment(this IRocketFunctionHostBuilder builder, IRocketEnvironment environment) { return(Swap(builder, GetOrCreateBuilder(builder, builder.FunctionsAssembly, null).With(environment))); }