Show / Hide Table of Contents

Class ServerContext

Context for serializing/deserializing native types (e.g. DateTime, double, boolean, etc.)

Inheritance
System.Object
ServerContext
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Innovator.Client
Assembly: Innovator.Client.dll
Syntax
public sealed class ServerContext : IServerContext, IFormatProvider, ICustomFormatter

Constructors

| Improve this Doc View Source

ServerContext(Boolean)

Create a server context in either the local or UTC time zone

Declaration
public ServerContext(bool utc)
Parameters
Type Name Description
System.Boolean utc

Indicates the UTC time zone should be used. Otherwise, the local time zone will be used

| Improve this Doc View Source

ServerContext(String)

Create a server context using the specified time zone name

Declaration
public ServerContext(string timeZoneName)
Parameters
Type Name Description
System.String timeZoneName

Properties

| Improve this Doc View Source

DefaultLanguageCode

Gets the default language code configured for the Aras user

Declaration
public string DefaultLanguageCode { get; set; }
Property Value
Type Description
System.String
Implements
IServerContext.DefaultLanguageCode
| Improve this Doc View Source

DefaultLanguageSuffix

Gets the default language suffix configured for the Aras user

Declaration
public string DefaultLanguageSuffix { get; set; }
Property Value
Type Description
System.String
Implements
IServerContext.DefaultLanguageSuffix
| Improve this Doc View Source

LanguageCode

Gets the language code configured for the Aras user

Declaration
public string LanguageCode { get; set; }
Property Value
Type Description
System.String
Implements
IServerContext.LanguageCode
| Improve this Doc View Source

LanguageSuffix

Gets the language suffix configured for the Aras user

Declaration
public string LanguageSuffix { get; set; }
Property Value
Type Description
System.String
Implements
IServerContext.LanguageSuffix
| Improve this Doc View Source

Locale

Gets the locale configured for the user.

Declaration
public string Locale { get; set; }
Property Value
Type Description
System.String
Implements
IServerContext.Locale
| Improve this Doc View Source

TimeZone

Gets the corporate time zone ID for the Aras installation

Declaration
public string TimeZone { get; set; }
Property Value
Type Description
System.String
Implements
IServerContext.TimeZone

Methods

| Improve this Doc View Source

AsBoolean(Object)

Converts the System.Object to a System.Boolean based on the locale and time zone

Declaration
public bool ? AsBoolean(object value)
Parameters
Type Name Description
System.Object value

The value.

Returns
Type Description
System.Nullable<System.Boolean>

null if value is null or empty. A System.Boolean if value is convertible. Otherwise, an exception is thrown

Implements
IServerContext.AsBoolean(Object)
Exceptions
Type Condition
System.InvalidCastException

If the non-empty value cannot be converted to a System.Boolean

| Improve this Doc View Source

AsDateTime(Object)

Converts the System.Object representing a date in the corporate time zone to a System.DateTime in the local time zone

Declaration
public DateTime? AsDateTime(object value)
Parameters
Type Name Description
System.Object value

The value.

Returns
Type Description
System.Nullable<System.DateTime>

null if value is null or empty. A System.DateTime if value is convertible. Otherwise, an exception is thrown

Implements
IServerContext.AsDateTime(Object)
Exceptions
Type Condition
System.InvalidCastException

If the non-empty value cannot be converted to a System.DateTime

| Improve this Doc View Source

AsDateTimeOffset(Object)

Converts the System.Object representing a date in the corporate time zone to a System.DateTimeOffset in the local time zone

Declaration
public DateTimeOffset? AsDateTimeOffset(object value)
Parameters
Type Name Description
System.Object value

The value.

Returns
Type Description
System.Nullable<System.DateTimeOffset>

null if value is null or empty. A System.DateTimeOffset if value is convertible. Otherwise, an exception is thrown

Implements
IServerContext.AsDateTimeOffset(Object)
Exceptions
Type Condition
System.InvalidCastException

If the non-empty value cannot be converted to a System.DateTimeOffset

| Improve this Doc View Source

AsDateTimeUtc(Object)

Converts the System.Object representing a date in the corporate time zone to a System.DateTime in the UTC time zone

Declaration
public DateTime? AsDateTimeUtc(object value)
Parameters
Type Name Description
System.Object value

The value.

Returns
Type Description
System.Nullable<System.DateTime>

null if value is null or empty. A System.DateTime if value is convertible. Otherwise, an exception is thrown

Implements
IServerContext.AsDateTimeUtc(Object)
Exceptions
Type Condition
System.InvalidCastException

If the non-empty value cannot be converted to a System.DateTime

| Improve this Doc View Source

AsDecimal(Object)

Converts the System.Object to a System.Decimal based on the locale and time zone

Declaration
public decimal ? AsDecimal(object value)
Parameters
Type Name Description
System.Object value

The value.

Returns
Type Description
System.Nullable<System.Decimal>

null if value is null or empty. A System.Decimal if value is convertible. Otherwise, an exception is thrown

Implements
IServerContext.AsDecimal(Object)
Exceptions
Type Condition
System.InvalidCastException

If the non-empty value cannot be converted to a System.Decimal

| Improve this Doc View Source

AsDouble(Object)

Converts the System.Object to a System.Double based on the locale and time zone

Declaration
public double ? AsDouble(object value)
Parameters
Type Name Description
System.Object value

The value.

Returns
Type Description
System.Nullable<System.Double>

null if value is null or empty. A System.Double if value is convertible. Otherwise, an exception is thrown

Implements
IServerContext.AsDouble(Object)
Exceptions
Type Condition
System.InvalidCastException

If the non-empty value cannot be converted to a System.Double

| Improve this Doc View Source

AsInt(Object)

Converts the System.Object to a System.Int32 based on the locale and time zone

Declaration
public int ? AsInt(object value)
Parameters
Type Name Description
System.Object value

The value.

Returns
Type Description
System.Nullable<System.Int32>

null if value is null or empty. A System.Int32 if value is convertible. Otherwise, an exception is thrown

Implements
IServerContext.AsInt(Object)
Exceptions
Type Condition
System.InvalidCastException

If the non-empty value cannot be converted to a System.Int32

| Improve this Doc View Source

AsLong(Object)

Converts the System.Object to a System.Int64 based on the locale and time zone

Declaration
public long ? AsLong(object value)
Parameters
Type Name Description
System.Object value

The value.

Returns
Type Description
System.Nullable<System.Int64>

null if value is null or empty. A System.Int64 if value is convertible. Otherwise, an exception is thrown

Implements
IServerContext.AsLong(Object)
Exceptions
Type Condition
System.InvalidCastException

If the non-empty value cannot be converted to a System.Int64

| Improve this Doc View Source

Format(Object)

Serializes the value to a string. Dates are converted to the corporate time zone

Declaration
public string Format(object value)
Parameters
Type Name Description
System.Object value

The value to serialize.

Returns
Type Description
System.String

A string representing the value

Implements
IServerContext.Format(Object)
| Improve this Doc View Source

Format(String, Object, IFormatProvider)

Converts the value of a specified object to an equivalent string representation using specified format and culture-specific formatting information.

Declaration
public string Format(string format, object arg, IFormatProvider formatProvider)
Parameters
Type Name Description
System.String format

A format string containing formatting specifications.

System.Object arg

An object to format.

System.IFormatProvider formatProvider

An object that supplies format information about the current instance.

Returns
Type Description
System.String

The string representation of the value of arg, formatted as specified by format and formatProvider.

Implements
System.ICustomFormatter.Format(System.String, System.Object, System.IFormatProvider)
| Improve this Doc View Source

GetFormat(Type)

Returns an object that provides formatting services for the specified type.

Declaration
public object GetFormat(Type formatType)
Parameters
Type Name Description
System.Type formatType

An object that specifies the type of format object to return.

Returns
Type Description
System.Object

An instance of the object specified by formatType, if the System.IFormatProvider implementation can supply that type of object; otherwise, null.

Implements
System.IFormatProvider.GetFormat(System.Type)

Extension Methods

ItemExtensions.Now(IServerContext)
  • Improve this Doc
  • View Source
Back to top Copyright © 2015-2017 Microsoft
Generated by DocFX