Class QueryParameterResolver
Resolves a query parameter value from a Microsoft.AspNetCore.Http.HttpContext.Request.
Inheritance
Implements
Namespace: EPiServer.Web.Internal
Assembly: EPiServer.Cms.AspNetCore.dll
Version: 12.0.3Syntax
public class QueryParameterResolver : Object, IQueryParameterResolver
Remarks
Purpose of class it to make it easier to write tests for dependents.
Constructors
QueryParameterResolver(IHttpContextAccessor)
Initializes a new instance of the QueryParameterResolver class.
Declaration
public QueryParameterResolver(IHttpContextAccessor httpContextAccessor)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Http.IHttpContextAccessor | httpContextAccessor |
QueryParameterResolver(IQueryCollection)
Initializes a new instance of the QueryParameterResolver class.
Declaration
public QueryParameterResolver(IQueryCollection parameters)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Http.IQueryCollection | parameters | The parameters to resolve values from. |
Methods
GetParameterValue(String)
Gets the value for the query parameter named queryKey
from the current request.
Declaration
public virtual string GetParameterValue(string queryKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | queryKey | The name of the query parameter. |
Returns
Type | Description |
---|---|
System.String | The value of the query parameter or null if parameter is not present. |
TryGet(String, out IEnumerable<Int32>)
Attempts to extract the value from a given query parameter to a list of integers.
Declaration
public bool TryGet(string queryKey, out IEnumerable<int> result)
Parameters
Type | Name | Description |
---|---|---|
System.String | queryKey | The query key. |
System.Collections.Generic.IEnumerable<System.Int32> | result | The parsed result. |
Returns
Type | Description |
---|---|
System.Boolean |
|
TryGet(String, out Int32)
Attempts to extract the value from a given query parameter to an integer.
Declaration
public bool TryGet(string queryKey, out int result)
Parameters
Type | Name | Description |
---|---|---|
System.String | queryKey | The query key. |
System.Int32 | result | The parsed result. |
Returns
Type | Description |
---|---|
System.Boolean |
|