Skip to main content

Definition

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

Syntax

CloudNimble.EasyAF.Configuration.HttpEndpointAttribute

Summary

Specifies that a configuration property represents an HTTP endpoint URL for an HttpClient. Used by the EasyAF configuration system to automatically register HttpClients with their base addresses.

Remarks

This attribute enables automatic HttpClient registration by linking configuration properties that contain URLs to the corresponding HttpClient name properties. The configuration system uses this information to set up named HttpClient instances with appropriate base addresses.

Examples

public class MyConfiguration : ConfigurationBase
{
    public string MyApiClientName { get; set; } = "MyApiClient";

    [HttpEndpoint(nameof(MyApiClientName))]
    public string MyApiRoot { get; set; } = "https://api.example.com";
}

// This will automatically register an HttpClient named "MyApiClient"
// with base address "https://api.example.com"

Constructors

.ctor

Initializes a new instance of the HttpEndpointAttribute class.

Syntax

public HttpEndpointAttribute(string clientNameProperty)

Parameters

NameTypeDescription
clientNamePropertystringThe name of the property that contains the HttpClient name for registration.

Exceptions

ExceptionDescription
ArgumentNullExceptionThrown when clientNameProperty is null.

Properties

ClientNameProperty

Gets or sets the name of the property that contains the HttpClient name to be registered. This property should contain the string value that will be used as the named HttpClient identifier.

Syntax

public string ClientNameProperty { get; set; }

Property Value

Type: string