Method Type Attribute

Important

This content is archived and is not being updated. For the latest documentation, see Microsoft Dynamics 365 product documentation. For the latest release plans, see Dynamics 365 and Microsoft Power Platform release plans.

Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

When you use the AIF Document Service Wizard to create a service in Microsoft Dynamics AX, it adds the method type attribute to each service class method that is exposed as a service operation. The method type attribute corresponds to the action that the method performs: create, read, update, delete, find, getKeys, getChangedKeys, and findKeys.

The following code shows the CustCustomerService.delete method decorated with the AifDocumentDeleteAttribute attribute.

[AifDocumentDeleteAttribute, SysEntryPointAttribute(true)] 
 public void delete(AifEntityKeyList _entityKeyList)
 {
     CustCustomer custCustomer = new CustCustomer();
     this.deleteList(_entityKeyList, custCustomer);
 }

Note

The SysEntryPointAttribute is required to be set for service operations. For more information, see Setting SysEntryPointAttribute for Services.

The method type attribute is used when you call the metadata service to return information about a particular service. For example, you could call the metadata service and request all the methods on a particular service class that have the AifDocumentDeleteAttribute attribute. This would return all the service methods that delete data. For more information, see Metadata Service.

The method type attribute is optional. However, if you add a method to a service class that performs one of these actions, you should use the corresponding method type attribute. The following table lists the method type attributes.

Attribute

Description

AifDocumentCreateAttribute

Specifies that the method creates a document.

AifDocumentDeleteAttribute

Specifies that the method deletes a document.

AifDocumentFindAttribute

Specifies that the method finds one or more documents.

AifDocumentFindKeysAttribute

Specifies that the method finds one or more documents and returns only the document keys.

AifDocumentReadAttribute

Specifies that the method reads a single document.

AifDocumentUpdateAttribute

Specifies that the method updates one or more documents.

AifDocumentGetKeysAttribute

Specifies that the method retrieves the keys for documents based on a document filter. For more information, see Configure processing options.

AifDocumentGetChangedKeysAttribute

Specifies that the method retrieves the keys for documents based on a document filter and a date that is passed in. For more information, see Configuring AIF for change tracking.

If you create your own custom document service, make sure that you add the method type attribute to the methods that are exposed as service operations.

See also

Metadata Service

Document Class Service Operations