IErpOperation Interface

Provides metadata about an OData action or function exposed by an ERP service.

Namespace: powerGate.Erp.Client
Assembly: powerGate.Erp.Client.dll

Syntax

1
public interface IErpOperation

Properties

Type

Name

Description

../../../_images/prop.ico string

Name

Gets the name of the action or function.

../../../_images/prop.ico string

Namespace

Gets the namespace where the action or function is defined.

../../../_images/prop.ico bool

IsFunction

Indicates whether the metadata describes a function. If false, it describes an action.

../../../_images/prop.ico object

BindingTarget

Gets the binding target for the action or function. This can be a primitive type, an IErpComplexType, or an IErpEntityType.

../../../_images/prop.ico IEnumerable<TypeReference>

Parameters

Gets the parameter definitions accepted by the action or function.

../../../_images/prop.ico TypeReference

ReturnType

Gets the return type definition of the action or function, if one is defined. This is can null because some OData actions and functions return no value.

Remarks

An OData action or function may be bound or unbound, and this metadata exposes the information required to identify it and prepare the corresponding request.

The BindingTarget value identifies the resource the action or function is bound to. It can represent a primitive type, an IErpComplexType, or an IErpEntityType.

Each entry in Parameters and the optional ReturnType value is represented by TypeReference, which provides the name, nullability, collection semantics, and target type metadata for the action or function signature.

Examples

Inspecting Metadata of an Action or Function and printing it to the console

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Linq;
using powerGate.Erp.Client;

namespace ErpOperationSample
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var erpclient = new ErpClient())
            {
                using (var service = erpclient.ConnectErp(new Uri("https://services.odata.org/TripPinRESTierService/")))
                {
                    var operation = service.Operations["Trippin.GetInvolvedPeople"];

                    Console.WriteLine($"Name: {operation.Name}");
                    Console.WriteLine($"IsFunction: {operation.IsFunction}");
                    Console.WriteLine($"BindingTarget: {operation.BindingTarget}");

                    foreach (var parameter in operation.Parameters)
                        Console.WriteLine($"Parameter: {parameter.Name}, IsNullable={parameter.IsNullable}, IsCollection={parameter.IsCollection}, Target={parameter.Target}");

                    if (operation.ReturnType.HasValue)
                    {
                        var returnType = operation.ReturnType.Value;
                        Console.WriteLine($"ReturnType: {returnType.Name}, IsNullable={returnType.IsNullable}, IsCollection={returnType.IsCollection}, Target={returnType.Target}");
                    }
                }
            }
        }
    }
}

See also

Reference