Skip to main content

Definition

Assembly: CloudNimble.EasyAF.Configuration.dll Namespace: CloudNimble.EasyAF.Configuration Inheritance: System.Object

Syntax

CloudNimble.EasyAF.Configuration.ConfigurationBase

Summary

A base class implementation of the configuration your Blazor app will pull from wwwroot/appsettings.json. Provides standard HttpClient configuration for API and application endpoints.

Remarks

This configuration class is typically used for customer-facing applications that need to communicate with external APIs and handle application-level HTTP requests. For administrative applications, consider using ConfigurationPlusAdminBase instead.

Examples

// In Program.cs or Startup.cs
builder.Services.AddConfigurationBase<MyAppConfiguration>(builder.Configuration, "AppSettings");

// Example configuration in appsettings.json
{
  "AppSettings": {
    "ApiRoot": "https://api.mycompany.com",
    "AppRoot": "https://myapp.mycompany.com",
    "HttpHandlerMode": "Add"
  }
}

// Usage in components
[Inject] public MyAppConfiguration Config { get; set; }

private async Task CallApi()
{
    var httpClient = HttpClientFactory.CreateClient(Config.ApiClientName);
    var response = await httpClient.GetAsync($"{Config.ApiRoot}/api/data");
}

Constructors

.ctor

Syntax

public ConfigurationBase()

.ctor Inherited

Inherited from object

Syntax

public Object()

Properties

ApiClientName

The name of the HttpClient that will be used to hit the app’s Public API.

Syntax

public string ApiClientName { get; set; }

Property Value

Type: string

ApiRoot

The root of the API that your Blazor app will call.

Syntax

public string ApiRoot { get; set; }

Property Value

Type: string

Remarks

Most Blazor apps will call at least one API. If you need to call more than one, just inherit from ConfigurationBase and add your own properties.

AppClientName

The name of the HttpClient that will be used to hit the Blazor App’s Controllers.

Syntax

public string AppClientName { get; set; }

Property Value

Type: string

AppRoot

The website your Blazor app is being served from.

Syntax

public string AppRoot { get; set; }

Property Value

Type: string

Remarks

Sometimes you will need to get information about the app’s deployment before it has been fully-initialized in Program.cs. This is the place to do it.

HttpHandlerMode

Determines how HttpClient message handlers are configured when registering HTTP clients. Controls whether handlers are added to existing handlers or replace them entirely.

Syntax

public CloudNimble.EasyAF.Core.HttpHandlerMode HttpHandlerMode { get; set; }

Property Value

Type: CloudNimble.EasyAF.Core.HttpHandlerMode

Methods

Equals Inherited Virtual

Inherited from object

Syntax

public virtual bool Equals(object obj)

Parameters

NameTypeDescription
objobject?-

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

public static bool Equals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

GetHashCode Inherited Virtual

Inherited from object

Syntax

public virtual int GetHashCode()

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

public System.Type GetType()

Returns

Type: System.Type

MemberwiseClone Inherited

Inherited from object

Syntax

protected internal object MemberwiseClone()

Returns

Type: object

ReferenceEquals Inherited

Inherited from object

Syntax

public static bool ReferenceEquals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?