Class MappingUtilities
Provides some utilities for mapping.
Inheritance
object
MappingUtilities
Namespace: StylelabsStylelabs.MSdkMappers
Assembly: Stylelabs.M.Sdk.dll
Syntax
RequestResponse
public static class MappingUtilities
Methods
AddInvariantIfEmpty(IEnumerable<CultureInfo>)
Adds to a list of .
Declaration
RequestResponse
public static CultureInfo[] AddInvariantIfEmpty(IEnumerable<CultureInfo> cultures)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<>CultureInfo | cultures |
The cultures. |
Returns
Type | Description |
---|---|
CultureInfo |
The extended list of . |
GetCulturesWithoutInvariant(IEnumerable<CultureInfo>)
Filters a list of by excluding .
Declaration
RequestResponse
public static CultureInfo[] GetCulturesWithoutInvariant(IEnumerable<CultureInfo> cultures)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<>CultureInfo | cultures |
The cultures. |
Returns
Type | Description |
---|---|
CultureInfo |
The filtered cultures. |
MapLabels(IDictionary<CultureInfo, string>)
Maps cultures to labels.
Declaration
RequestResponse
public static Dictionary<string, string> MapLabels(IDictionary<CultureInfo, string> dict)
Parameters
Type | Name | Description |
---|---|---|
IDictionary<, >CultureInfostring | dict |
The cultures. |
Returns
Type | Description |
---|---|
Dictionary<, >stringstring |
The labels. |
MapLabels(IDictionary<string, string>)
Maps labels to cultures.
Declaration
RequestResponse
public static IDictionary<CultureInfo, string> MapLabels(IDictionary<string, string> dict)
Parameters
Type | Name | Description |
---|---|---|
IDictionary<, >stringstring | dict |
The labels. |
Returns
Type | Description |
---|---|
IDictionary<, >CultureInfostring |
The cultures. |
NullableToDate(DateTime?)
Coverts a nullable to a .
Declaration
RequestResponse
public static DateTime NullableToDate(DateTime? dateTime)
Parameters
Type | Name | Description |
---|---|---|
DateTime | dateTime |
The nullable . |
Returns
Type | Description |
---|---|
DateTime |
The . |
NullableToId(long?)
Converts a nullable id to an id.
Declaration
RequestResponse
public static long NullableToId(long? id)
Parameters
Type | Name | Description |
---|---|---|
long | id |
An id. |
Returns
Type | Description |
---|---|
long |
A . |
SdkCulturesToLoadOption(IEnumerable<CultureInfo>)
Creates a load option for the passed cultures, but does not check for invariant culture.
Declaration
RequestResponse
public static ICultureLoadOption SdkCulturesToLoadOption(IEnumerable<CultureInfo> cultures)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<>CultureInfo | cultures |
The cultures. |
Returns
Type | Description |
---|---|
ICultureLoadOption |
The ICultureLoadOption. |
ToNullableDate(DateTime)
Converts a to a nullable . will be mapped to null.
Declaration
RequestResponse
public static DateTime? ToNullableDate(DateTime dateTime)
Parameters
Type | Name | Description |
---|---|---|
DateTime | dateTime |
A . |
Returns
Type | Description |
---|---|
DateTime |
A nullable . |
ToNullableId(long)
Converts an id to a nullable id. 0 will be mapped to null.
Declaration
RequestResponse
public static long? ToNullableId(long id)
Parameters
Type | Name | Description |
---|---|---|
long | id |
An id. |
Returns
Type | Description |
---|---|
long |
A nullable . |