EnumerationController<TStruct,TValue> Class
Base class for controllers exposing endpoints for looking up known values of IEnumeration<TStruct> implementing types along with any additional properties that have been assigned to them.
public abstract class EnumerationController<TStruct,TValue> : Microsoft.AspNetCore.Mvc.Controller where TStruct : struct, HAKOM.TSM.Net.Api.IEnumeration<TStruct, TValue>, System.IEquatable<TStruct>, System.ValueType, System.ValueType where TValue : System.Numerics.INumber<TValue>Type parameters
Section titled “Type parameters”TStruct
The type of struct for which to expose endpoints.
TValue
Inheritance System.Object 🡒 Microsoft.AspNetCore.Mvc.ControllerBase 🡒 Microsoft.AspNetCore.Mvc.Controller 🡒 EnumerationController<TStruct,TValue>
Remarks
Section titled “Remarks”Implementations must have a Microsoft.AspNetCore.Mvc.RouteAttribute specifying the root of the endpoints underneath.
Constructors
Section titled “Constructors”EnumerationController(IEnumerable<IEnumerationPropertyProvider<TStruct>>, IHttpFailureFactory) Constructor
Section titled “EnumerationController(IEnumerable<IEnumerationPropertyProvider<TStruct>>, IHttpFailureFactory) Constructor”Creates an instance of the controller. Call this from derived types.
protected EnumerationController(System.Collections.Generic.IEnumerable<HAKOM.TSM.Net.Api.IEnumerationPropertyProvider<TStruct>> propertyProviders, HAKOM.ErrorHandling.Http.Net.Api.IHttpFailureFactory httpFailureFactory);Parameters
Section titled “Parameters”propertyProviders System.Collections.Generic.IEnumerable<HAKOM.TSM.Net.Api.IEnumerationPropertyProvider<TStruct>>
A collection of all the registered IEnumerationPropertyProvider<TStruct> implementations for TStruct.
httpFailureFactory IHttpFailureFactory
Used to generate common errors.
Methods
Section titled “Methods”EnumerationController<TStruct,TValue>.FindAllKnownEnumerations() Method
Section titled “EnumerationController<TStruct,TValue>.FindAllKnownEnumerations() Method”Returns all known values of TStruct along with any properties mapped to it.
protected System.Collections.Generic.IEnumerable<HAKOM.TSM.Net.Api.IEnumeration<TStruct,TValue>> FindAllKnownEnumerations();Returns
Section titled “Returns”System.Collections.Generic.IEnumerable<HAKOM.TSM.Net.Api.IEnumeration<TStruct,TValue>>
Remarks
Section titled “Remarks”Any value of TStruct is considered <i>known</i> if it has one or more properties mapped to it by an implementation of IEnumerationPropertyProvider<TStruct>.
EnumerationController<TStruct,TValue>.GetEnumerationByProperty(string, string) Method
Section titled “EnumerationController<TStruct,TValue>.GetEnumerationByProperty(string, string) Method”Returns the TStruct with a property named propertyName mapped to a value of propertyValue along with any additional properties mapped to it.
protected HAKOM.ErrorHandling.Core.Net.Api.Result<HAKOM.TSM.Net.Api.IEnumeration<TStruct,TValue>> GetEnumerationByProperty(string propertyName, string propertyValue);Parameters
Section titled “Parameters”propertyName System.String
The name of the property by which to look up the TStruct for which to retrieve its properties.
propertyValue System.String
The value of the property mapped to the TStruct for which to retrieve its properties.
Returns
Section titled “Returns”HAKOM.ErrorHandling.Core.Net.Api.Result<HAKOM.TSM.Net.Api.IEnumeration<TStruct,TValue>>
A Result indicating success or failure of retrieving the TStruct with the property identified by propertyName being mapped to the given propertyValue.
EnumerationController<TStruct,TValue>.GetEnumerationByValue(TValue) Method
Section titled “EnumerationController<TStruct,TValue>.GetEnumerationByValue(TValue) Method”Returns the TStruct with the given value along with any additional properties mapped to it.
protected HAKOM.ErrorHandling.Core.Net.Api.Result<HAKOM.TSM.Net.Api.IEnumeration<TStruct,TValue>> GetEnumerationByValue(TValue value);Parameters
Section titled “Parameters”value TValue
The value of the TStruct for which to retrieve its properties.
Returns
Section titled “Returns”HAKOM.ErrorHandling.Core.Net.Api.Result<HAKOM.TSM.Net.Api.IEnumeration<TStruct,TValue>>
A Result indicating success or failure of retrieving the TStruct with the given value.
EnumerationController<TStruct,TValue>.GetEnumerationPropertyByName(string, string) Method
Section titled “EnumerationController<TStruct,TValue>.GetEnumerationPropertyByName(string, string) Method”Returns the value of the property identified by propertyName for the TStruct with the given name.
protected HAKOM.ErrorHandling.Core.Net.Api.Result<object> GetEnumerationPropertyByName(string name, string propertyName);Parameters
Section titled “Parameters”name System.String
The value of the TStruct for which to retrieve the value of the property with the given propertyName.
propertyName System.String
The name of the property for which to retrieve the value mapped to the TStruct with the given name.
Returns
Section titled “Returns”HAKOM.ErrorHandling.Core.Net.Api.Result<System.Object>
A Result indicating success or failure of retrieving a value for the property of TStruct with the given name.
EnumerationController<TStruct,TValue>.GetEnumerationPropertyByValue(TValue, string) Method
Section titled “EnumerationController<TStruct,TValue>.GetEnumerationPropertyByValue(TValue, string) Method”Returns the value of the property identified by propertyName for the TStruct with the given value.
protected HAKOM.ErrorHandling.Core.Net.Api.Result<object> GetEnumerationPropertyByValue(TValue value, string propertyName);Parameters
Section titled “Parameters”value TValue
The value of the TStruct for which to retrieve the value of the property with the given propertyName.
propertyName System.String
The name of the property for which to retrieve the value mapped to the TStruct with the given value.
Returns
Section titled “Returns”HAKOM.ErrorHandling.Core.Net.Api.Result<System.Object>
A Result indicating success or failure of retrieving a value for the property of TStruct with the given value.