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
TypeNameDescription
IEnumerable<>CultureInfocultures

The cultures.

Returns
TypeDescription
CultureInfo

The extended list of .

GetCulturesWithoutInvariant(IEnumerable<CultureInfo>)

Filters a list of by excluding .

Declaration
RequestResponse

public static CultureInfo[] GetCulturesWithoutInvariant(IEnumerable<CultureInfo> cultures)
Parameters
TypeNameDescription
IEnumerable<>CultureInfocultures

The cultures.

Returns
TypeDescription
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
TypeNameDescription
IDictionary<, >CultureInfostringdict

The cultures.

Returns
TypeDescription
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
TypeNameDescription
IDictionary<, >stringstringdict

The labels.

Returns
TypeDescription
IDictionary<, >CultureInfostring

The cultures.

NullableToDate(DateTime?)

Coverts a nullable to a .

Declaration
RequestResponse

public static DateTime NullableToDate(DateTime? dateTime)
Parameters
TypeNameDescription
DateTimedateTime

The nullable .

Returns
TypeDescription
DateTime

The .

NullableToId(long?)

Converts a nullable id to an id.

Declaration
RequestResponse

public static long NullableToId(long? id)
Parameters
TypeNameDescription
longid

An id.

Returns
TypeDescription
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
TypeNameDescription
IEnumerable<>CultureInfocultures

The cultures.

Returns

ToNullableDate(DateTime)

Converts a to a nullable .

RequestResponse
      <see cref="!:DateTime.MinValue"></see>will be mapped to <span class="xref">null</span>.
    </p>
  </div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration" id="declaration-7">Declaration</h5>
  <div class="codewrapper">
    <pre class="shiki shiki-themes one-dark-pro one-dark-pro not-prose" style="background-color:#282c34;--shiki-dark-bg:#282c34;color:#abb2bf;--shiki-dark:#abb2bf" tabindex="0"><code><span class="line"></span>

public static DateTime? ToNullableDate(DateTime dateTime)

Parameters
TypeNameDescription
DateTimedateTime

A .

Returns
TypeDescription
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
TypeNameDescription
longid

An id.

Returns
TypeDescription
long

A nullable .

Do you have some feedback for us?

If you have suggestions for improving this article,