Innovt Platform
Search Results for

    Show / Hide Table of Contents

    Class ApiStartupBase

    Base class for configuring API startup settings and dependencies.

    Inheritance
    object
    ApiStartupBase
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Innovt.AspNetCore
    Assembly: Innovt.AspNetCore.dll
    Syntax
    public abstract class ApiStartupBase

    Constructors

    | Edit this page View Source

    ApiStartupBase(IConfiguration, IWebHostEnvironment, string, bool)

    Initializes a new instance of the ApiStartupBase class with the specified configuration and environment.

    Declaration
    protected ApiStartupBase(IConfiguration configuration, IWebHostEnvironment environment, string appName, bool setDefaultJsonOptions = true)
    Parameters
    Type Name Description
    IConfiguration configuration

    The configuration for the application.

    IWebHostEnvironment environment

    The hosting environment for the application.

    string appName

    The name of the application.

    bool setDefaultJsonOptions

    This is the default convention for Serialization/Deserialization

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if configuration, environment, or appName is null.

    | Edit this page View Source

    ApiStartupBase(IConfiguration, IWebHostEnvironment, string, string, string, string, string?, string?, bool)

    Initializes a new instance of the ApiStartupBase class with additional API documentation details.

    Declaration
    protected ApiStartupBase(IConfiguration configuration, IWebHostEnvironment environment, string appName, string apiTitle, string apiDescription, string apiVersion, string? contactName = null, string? contactEmail = null, bool setDefaultJsonOptions = true)
    Parameters
    Type Name Description
    IConfiguration configuration

    The configuration for the application.

    IWebHostEnvironment environment

    The hosting environment for the application.

    string appName

    The name of the application.

    string apiTitle

    The title of the API.

    string apiDescription

    The description of the API.

    string apiVersion

    The version of the API.

    string contactName

    The name of the API contact (optional).

    string contactEmail

    The email of the API contact (optional).

    bool setDefaultJsonOptions

    This is the default convention for Serialization/Deserialization

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if configuration, environment, appName, apiTitle, apiDescription, or apiVersion is null.

    Properties

    | Edit this page View Source

    AppName

    Gets the name of the application.

    Declaration
    public string AppName { get; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Configuration

    Gets the configuration for the application.

    Declaration
    public IConfiguration Configuration { get; }
    Property Value
    Type Description
    IConfiguration
    | Edit this page View Source

    DefaultHealthPath

    Gets or sets the default health path for the application.

    Declaration
    protected string DefaultHealthPath { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Documentation

    Gets or sets the API documentation details.

    Declaration
    protected DefaultApiDocumentation Documentation { get; set; }
    Property Value
    Type Description
    DefaultApiDocumentation
    | Edit this page View Source

    Environment

    Gets the hosting environment for the application.

    Declaration
    public IWebHostEnvironment Environment { get; }
    Property Value
    Type Description
    IWebHostEnvironment
    | Edit this page View Source

    Localization

    Gets or sets the localization settings for the API.

    Declaration
    protected DefaultApiLocalization Localization { get; set; }
    Property Value
    Type Description
    DefaultApiLocalization
    | Edit this page View Source

    SetDefaultJsonOptions

    If true will set default Json Options(JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase) etc

    Declaration
    public bool SetDefaultJsonOptions { get; set; }
    Property Value
    Type Description
    bool

    Methods

    | Edit this page View Source

    AddDefaultServices(IServiceCollection)

    Adds default services to the service collection.

    Declaration
    protected abstract void AddDefaultServices(IServiceCollection services)
    Parameters
    Type Name Description
    IServiceCollection services

    The service collection to add default services to.

    | Edit this page View Source

    AddSwagger(IServiceCollection)

    Adds Swagger generation to the specified services.

    Declaration
    protected virtual void AddSwagger(IServiceCollection services)
    Parameters
    Type Name Description
    IServiceCollection services

    The service collection to add Swagger to.

    | Edit this page View Source

    AddTracing(IServiceCollection)

    Adds tracing and telemetry to the specified services.

    Declaration
    protected virtual void AddTracing(IServiceCollection services)
    Parameters
    Type Name Description
    IServiceCollection services

    The service collection to add tracing to.

    | Edit this page View Source

    Configure(IApplicationBuilder, IWebHostEnvironment, ILoggerFactory)

    Configure Will Add All main Services as Default for Api and MVC Applications

    Declaration
    public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
    Parameters
    Type Name Description
    IApplicationBuilder app
    IWebHostEnvironment env
    ILoggerFactory loggerFactory
    | Edit this page View Source

    ConfigureApiBehavior()

    Configures API behavior options.

    Declaration
    protected virtual Action<ApiBehaviorOptions> ConfigureApiBehavior()
    Returns
    Type Description
    Action<ApiBehaviorOptions>

    An action that configures ApiBehaviorOptions.

    | Edit this page View Source

    ConfigureApp(IApplicationBuilder, IWebHostEnvironment, ILoggerFactory)

    Configures the application.

    Declaration
    public abstract void ConfigureApp(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
    Parameters
    Type Name Description
    IApplicationBuilder app

    The application builder.

    IWebHostEnvironment env

    The hosting environment.

    ILoggerFactory loggerFactory

    The logger factory.

    | Edit this page View Source

    ConfigureCultures(IApplicationBuilder)

    Configures request cultures for the application.

    Declaration
    protected virtual void ConfigureCultures(IApplicationBuilder app)
    Parameters
    Type Name Description
    IApplicationBuilder app

    The application builder.

    | Edit this page View Source

    ConfigureHealthChecks(IServiceCollection)

    Implement only the AddHealthChecks by default

    Declaration
    protected virtual void ConfigureHealthChecks(IServiceCollection services)
    Parameters
    Type Name Description
    IServiceCollection services
    | Edit this page View Source

    ConfigureIoC(IServiceCollection)

    Configures the IoC container for the application.

    Declaration
    protected abstract void ConfigureIoC(IServiceCollection services)
    Parameters
    Type Name Description
    IServiceCollection services

    The service collection to configure for IoC.

    | Edit this page View Source

    ConfigureOpenTelemetry(TracerProviderBuilder)

    Configures OpenTelemetry for tracing.

    Declaration
    protected abstract void ConfigureOpenTelemetry(TracerProviderBuilder builder)
    Parameters
    Type Name Description
    TracerProviderBuilder builder

    The TracerProviderBuilder for configuring tracing.

    | Edit this page View Source

    ConfigureServices(IServiceCollection)

    Configure services will register default services for api and mvc applications. AddHealthChecks

    Declaration
    public virtual void ConfigureServices(IServiceCollection services)
    Parameters
    Type Name Description
    IServiceCollection services
    | Edit this page View Source

    ConfigureSwaggerUi(IApplicationBuilder, IWebHostEnvironment)

    Configures Swagger UI for API documentation.

    Declaration
    protected virtual void ConfigureSwaggerUi(IApplicationBuilder app, IWebHostEnvironment env)
    Parameters
    Type Name Description
    IApplicationBuilder app

    The application builder.

    IWebHostEnvironment env

    The hosting environment.

    | Edit this page View Source

    IsDevelopmentEnvironment()

    Checks if the application is running in a development environment.

    Declaration
    protected bool IsDevelopmentEnvironment()
    Returns
    Type Description
    bool

    True if the application is in development; otherwise, false.

    Extension Methods

    Extensions.IsNull(object)
    Extensions.ToStringOrDefault(object)
    SimpleMapper.MapTo<T1>(object)
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX