Skip to content
Documentation

HttpContextExtensions Class

Contains extension methods for passing state between middleware using Microsoft.AspNetCore.Http.HttpContext.Items.

public static class HttpContextExtensions

Inheritance System.Object 🡒 HttpContextExtensions

HttpContextExtensions.SetRequestRepository(this HttpContext, ITsmRepository) Method

Section titled “HttpContextExtensions.SetRequestRepository(this HttpContext, ITsmRepository) Method”

Whenever a request occurs in the context of a repository (i.e. /repositories/<repository>/...) this method can be used to add that repository to the Microsoft.AspNetCore.Http.HttpContext.Items dictionary so that other methods within the request pipeline do not have to repeat the call to Load(string, CancellationToken).

public static void SetRequestRepository(this Microsoft.AspNetCore.Http.HttpContext context, HAKOM.TSM.Net.Api.Persistence.ITsmRepository repository);

context Microsoft.AspNetCore.Http.HttpContext

The Microsoft.AspNetCore.Http.HttpContext to add the repository to.

repository ITsmRepository

The ITsmRepository to use for this request.

HttpContextExtensions.SetTimeSeriesReference(this HttpContext, Result<ITimeSeriesReference>) Method

Section titled “HttpContextExtensions.SetTimeSeriesReference(this HttpContext, Result<ITimeSeriesReference>) Method”

Whenever a request occurs in the context of a time series reference (i.e., /repositories/<repository>/timeseries/<timeseries>/...), this method can be used to add that time series reference to the Microsoft.AspNetCore.Http.HttpContext.Items dictionary so that other methods within the request pipeline have access to it without having to parse it again from the route or query parameters.

public static void SetTimeSeriesReference(this Microsoft.AspNetCore.Http.HttpContext context, HAKOM.ErrorHandling.Core.Net.Api.Result<HAKOM.TSM.Net.Api.TimeSeries.Persistence.References.ITimeSeriesReference> reference);

context Microsoft.AspNetCore.Http.HttpContext

The Microsoft.AspNetCore.Http.HttpContext to add the time series reference to.

reference HAKOM.ErrorHandling.Core.Net.Api.Result<ITimeSeriesReference>

The Result<TValue> containing the ITimeSeriesReference to use for this request.

HttpContextExtensions.TryGetRequestAttributeStore(this HttpContext, CancellationToken) Method

Section titled “HttpContextExtensions.TryGetRequestAttributeStore(this HttpContext, CancellationToken) Method”

Attempts to get the IAttributeStore to use for this request.

public static System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<HAKOM.TSM.Net.Api.Attributes.Persistence.IAttributeStore>> TryGetRequestAttributeStore(this Microsoft.AspNetCore.Http.HttpContext httpContext, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

httpContext Microsoft.AspNetCore.Http.HttpContext

The Microsoft.AspNetCore.Http.HttpContext to get the store from.

cancellationToken System.Threading.CancellationToken

A token that may be used to cancel the operation.

System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<IAttributeStore>>
The IAttributeStore set for this request. If there isn’t one, a new instance will be created with the repository from the httpContext.

HttpContextExtensions.TryGetRequestAttributeTypeStore(this HttpContext, CancellationToken) Method

Section titled “HttpContextExtensions.TryGetRequestAttributeTypeStore(this HttpContext, CancellationToken) Method”

Attempts to get the IAttributeTypeStore to use for this request.

public static System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<HAKOM.TSM.Net.Api.Attributes.Persistence.IAttributeTypeStore>> TryGetRequestAttributeTypeStore(this Microsoft.AspNetCore.Http.HttpContext httpContext, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

httpContext Microsoft.AspNetCore.Http.HttpContext

The Microsoft.AspNetCore.Http.HttpContext to get the store from.

cancellationToken System.Threading.CancellationToken

A token that may be used to cancel the operation.

System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<IAttributeTypeStore>>
The IAttributeTypeStore set for this request. If there isn’t one, a new instance will be created with the repository from the httpContext.

HttpContextExtensions.TryGetRequestListAttributeUnitStore(this HttpContext, CancellationToken) Method

Section titled “HttpContextExtensions.TryGetRequestListAttributeUnitStore(this HttpContext, CancellationToken) Method”

Attempts to get the IListAttributeUnitStore to use for this request.

public static System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<HAKOM.TSM.Net.Api.Attributes.Lists.Persistence.IListAttributeUnitStore>> TryGetRequestListAttributeUnitStore(this Microsoft.AspNetCore.Http.HttpContext httpContext, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

httpContext Microsoft.AspNetCore.Http.HttpContext

The Microsoft.AspNetCore.Http.HttpContext to get the store from.

cancellationToken System.Threading.CancellationToken

A token that may be used to cancel the operation.

System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<IListAttributeUnitStore>>
The IListAttributeUnitStore set for this request. If there isn’t one, a new instance will be created with the repository from the httpContext.

HttpContextExtensions.TryGetRequestListAttributeValueStore(this HttpContext, CancellationToken) Method

Section titled “HttpContextExtensions.TryGetRequestListAttributeValueStore(this HttpContext, CancellationToken) Method”

Retrieves the IListAttributeValueStore for HTTP requests.

public static System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<HAKOM.TSM.Net.Api.Attributes.Lists.Persistence.IListAttributeValueStore>> TryGetRequestListAttributeValueStore(this Microsoft.AspNetCore.Http.HttpContext httpContext, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

httpContext Microsoft.AspNetCore.Http.HttpContext

The Microsoft.AspNetCore.Http.HttpContext to get the store from.

cancellationToken System.Threading.CancellationToken

A token that may be used to cancel the operation.

System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<IListAttributeValueStore>>

HttpContextExtensions.TryGetRequestNodeStore(this HttpContext, CancellationToken) Method

Section titled “HttpContextExtensions.TryGetRequestNodeStore(this HttpContext, CancellationToken) Method”

Attempts to get the INodeStore to use for this request.

public static System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<HAKOM.TSM.Net.Api.Attributes.Nodes.Persistence.INodeStore>> TryGetRequestNodeStore(this Microsoft.AspNetCore.Http.HttpContext httpContext, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

httpContext Microsoft.AspNetCore.Http.HttpContext

The Microsoft.AspNetCore.Http.HttpContext to get the store from.

cancellationToken System.Threading.CancellationToken

A token that may be used to cancel the operation.

System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<INodeStore>>
The INodeStore set for this request. If there isn’t one, a new instance will be created with the repository from the httpContext.

HttpContextExtensions.TryGetRequestRepository(this HttpContext, ITsmRepository) Method

Section titled “HttpContextExtensions.TryGetRequestRepository(this HttpContext, ITsmRepository) Method”

Attempts to get the ITsmRepository to use for this request.

public static bool TryGetRequestRepository(this Microsoft.AspNetCore.Http.HttpContext context, out HAKOM.TSM.Net.Api.Persistence.ITsmRepository repository);

context Microsoft.AspNetCore.Http.HttpContext

The Microsoft.AspNetCore.Http.HttpContext to get the repository from.

repository ITsmRepository

Returns the repository previously set by SetRequestRepository(this HttpContext, ITsmRepository).

System.Boolean
true if there is a repository set for this request. false otherwise.

HttpContextExtensions.TryGetRequestTimeDependentUnitConversionStore(this HttpContext, CancellationToken) Method

Section titled “HttpContextExtensions.TryGetRequestTimeDependentUnitConversionStore(this HttpContext, CancellationToken) Method”

Retrieves the IUnitStore for HTTP requests.

public static System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<HAKOM.TSM.Net.Api.Units.Persistence.ITimeDependentUnitConversionStore>> TryGetRequestTimeDependentUnitConversionStore(this Microsoft.AspNetCore.Http.HttpContext httpContext, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

httpContext Microsoft.AspNetCore.Http.HttpContext

cancellationToken System.Threading.CancellationToken

System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<ITimeDependentUnitConversionStore>>
A System.Threading.Tasks.Task<> of Result<TValue>

HttpContextExtensions.TryGetRequestTimeSeriesReference(this HttpContext) Method

Section titled “HttpContextExtensions.TryGetRequestTimeSeriesReference(this HttpContext) Method”

Attempts to get the Result<TValue> containing the ITimeSeriesReference to use for this request. This is used to retrieve the reference of the time series that is currently processed in the request pipeline.

public static HAKOM.ErrorHandling.Core.Net.Api.Result<HAKOM.TSM.Net.Api.TimeSeries.Persistence.References.ITimeSeriesReference> TryGetRequestTimeSeriesReference(this Microsoft.AspNetCore.Http.HttpContext httpContext);

httpContext Microsoft.AspNetCore.Http.HttpContext

The Microsoft.AspNetCore.Http.HttpContext to get the time series reference from.

HAKOM.ErrorHandling.Core.Net.Api.Result<ITimeSeriesReference>
The ITimeSeriesReference for the request.

HttpContextExtensions.TryGetRequestTimeSeriesStore(this HttpContext, CancellationToken) Method

Section titled “HttpContextExtensions.TryGetRequestTimeSeriesStore(this HttpContext, CancellationToken) Method”

Attempts to get the ITimeSeriesStore to use for this request.

public static System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<HAKOM.TSM.Net.Api.TimeSeries.Persistence.ITimeSeriesStore>> TryGetRequestTimeSeriesStore(this Microsoft.AspNetCore.Http.HttpContext httpContext, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

httpContext Microsoft.AspNetCore.Http.HttpContext

The Microsoft.AspNetCore.Http.HttpContext to get the store from.

cancellationToken System.Threading.CancellationToken

A token that may be used to cancel the operation.

System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<ITimeSeriesStore>>
The ITimeSeriesStore set for this request. If there isn’t one, a new instance will be created with the repository from the httpContext.

HttpContextExtensions.TryGetRequestUnitStore(this HttpContext, CancellationToken) Method

Section titled “HttpContextExtensions.TryGetRequestUnitStore(this HttpContext, CancellationToken) Method”

Retrieves the IUnitStore for HTTP requests.

public static System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<HAKOM.TSM.Net.Api.Units.Persistence.IUnitStore>> TryGetRequestUnitStore(this Microsoft.AspNetCore.Http.HttpContext httpContext, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

httpContext Microsoft.AspNetCore.Http.HttpContext

cancellationToken System.Threading.CancellationToken

System.Threading.Tasks.Task<HAKOM.ErrorHandling.Core.Net.Api.Result<IUnitStore>>
A System.Threading.Tasks.Task<> of Result<TValue>

© 2026 Volue.Version v0.6.38017 November 2026