Export (0) Print
Expand All

AIF Services and Primitive Data Type Conversions for XML and .NET Framework

Dynamics AX 2009

The primitive data types that clients can send to Application Integration Framework (AIF) based services are automatically converted into their X++ counterparts. Also, a primitive type that is returned to the client from an AIF based service is converted into a primitive type that is appropriate for the client.

The following table lists the sets of primitive data types that can be automatically converted to X++ primitive types. The table shows the clients that use each set of primitive types.

Set of primitive data types

Clients of AIF

.NET Framework primitive types

  • Windows Communication Foundation (WCF), including Web service calls from .NET Framework languages such as C#

  • BizTalk Server clients

XML primitive types

  • File system based clients

  • Microsoft Message Queuing (MSMQ) based clients

  • BizTalk Server clients

You can create a custom Web service for AIF. Your Web service might accept parameters of the primitive types that are available in X++. The mechanisms of Web services and Windows Communication Foundation (WCF) can implicitly convert the .NET Framework primitive types to their XML data type counterparts. The XML types are implicitly converted to their X++ counterparts. The primitive return type from the Web service back to a .NET Framework program is also implicitly converted.

The following table displays the available implicit conversions.

.NET

XML

X++

System.Guid

guid

guid

System.Boolean

boolean

boolean (enum)

System.String

string

Enum

System.String

string

str

(This includes strings of a set length or of variable length, and right-aligned strings.)

System.Int32

int

int

System.Int64

long

int64

System.Double

double

real

System.DateTime

(Only the date portion is used.)

date

date

System.DateTime

(Only the time portion is used.)

time

timeOfDay

System.DateTime

dateTime

utcDateTime

For more information about implicit conversions between primitive data types, see

How to: Marshal Between X++ and CLR Primitive Types.

Microsoft Dynamics AX has the following three date/time related data types:

  • date

  • timeOfDay

  • utcDateTime

An AIF Web service can input parameters of these three date/time data types. When the Web service is called from C#, an instance of the System.DateTime class can be provided as the parameter value. However, the Kind property of the System.DateTime object must be set properly to avoid faulty value comparisons based on time zone confusions.

Setting the Kind Property

The following table shows the valid and invalid settings for the Kind property when you pass a System.DateTime object for an X++ date/time data type parameter. The values specified in the table header are from the System.DateTimeKind enum of the .NET Framework.

X++ data type

Kind = Unspecified

Kind = Utc

Kind = Local

date

Okay

Okay

Invalid comparison

timeOfDay

Okay

Okay

Invalid comparison

utcDateTime

Exception

Okay

Exception

Default Settings for the Kind Property

The following table shows the default setting that is made by various techniques of constructing a System.DateTime object.

Construction technique

Kind property setting

System.DateTime.Now()

Local

System.DateTime.UtcNow()

Utc

new System.DateTime( 2008, 04, 24, 16, 33, 59)

Unspecified

Community Additions

ADD
Show:
© 2014 Microsoft