Skip to main content

Definition

Assembly: Microsoft.OData.Mcp.Core.dll Namespace: Microsoft.OData.Mcp.Core.Models Inheritance: System.Object

Syntax

Microsoft.OData.Mcp.Core.Models.EdmFunctionImport

Summary

Represents a function import in an OData entity container.

Remarks

Function imports expose functions as addressable resources in the OData service. They allow functions to be called through the service interface, providing custom operations that don’t fit the standard CRUD pattern. Functions are side-effect free and can be invoked using GET requests.

Constructors

.ctor

Initializes a new instance of the EdmFunctionImport class.

Syntax

public EdmFunctionImport()

.ctor

Initializes a new instance of the EdmFunctionImport class with the specified name and function.

Syntax

public EdmFunctionImport(string name, string function)

Parameters

NameTypeDescription
namestringThe name of the function import.
functionstringThe fully qualified name of the function being imported.

Exceptions

ExceptionDescription
ArgumentExceptionThrown when name or function is null or whitespace.

.ctor Inherited

Inherited from object

Syntax

public Object()

Properties

Annotations

Gets or sets the annotations for this function import.

Syntax

public System.Collections.Generic.Dictionary<string, object> Annotations { get; set; }

Property Value

Type: System.Collections.Generic.Dictionary<string, object> A dictionary of annotations that provide additional metadata about the function import.

Remarks

Annotations can be used to specify additional behaviors, constraints, or metadata that are not captured by the standard OData model elements.

EntitySet

Gets or sets the entity set associated with this function import.

Syntax

public string EntitySet { get; set; }

Property Value

Type: string? The name of the entity set, or null if the function doesn’t return entities from a specific set.

Remarks

When the function returns entities, this property specifies which entity set those entities belong to. This is important for establishing the correct context for navigation properties and other operations.

Function

Gets or sets the fully qualified name of the function being imported.

Syntax

public required string Function { get; set; }

Property Value

Type: string The namespace and name of the function that this import exposes.

Remarks

This references a function defined elsewhere in the model. The function import makes the function accessible as part of the entity container’s interface.

IncludeInServiceDocument

Gets or sets a value indicating whether this function import is included in the service document.

Syntax

public bool IncludeInServiceDocument { get; set; }

Property Value

Type: bool true if the function import should be included in the service document; otherwise, false.

Remarks

When true, the function import will be listed in the service document, making it discoverable by clients. When false, clients must know the function import name in advance to use it.

Name

Gets or sets the name of the function import.

Syntax

public required string Name { get; set; }

Property Value

Type: string The name used to address this function import in OData URLs.

Remarks

The function import name appears in the URL path when invoking the function.

Methods

AddAnnotation

Adds an annotation to this function import.

Syntax

public void AddAnnotation(string term, object value)

Parameters

NameTypeDescription
termstringThe annotation term.
valueobjectThe annotation value.

Exceptions

ExceptionDescription
ArgumentExceptionThrown when term is null or whitespace.

Equals Override

Determines whether the specified object is equal to the current function import.

Syntax

public override bool Equals(object obj)

Parameters

NameTypeDescription
objobject?The object to compare with the current function import.

Returns

Type: bool true if the specified object is equal to the current function import; otherwise, false.

Equals Inherited Virtual

Inherited from object

Syntax

public virtual bool Equals(object obj)

Parameters

NameTypeDescription
objobject?-

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

public static bool Equals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

GetAnnotation

Gets an annotation value by term.

Syntax

public T GetAnnotation<T>(string term)

Parameters

NameTypeDescription
termstringThe annotation term.

Returns

Type: T? The annotation value, or the default value of T if not found.

Type Parameters

  • T - The type of the annotation value.

GetHashCode Override

Returns a hash code for the current function import.

Syntax

public override int GetHashCode()

Returns

Type: int A hash code for the current function import.

GetHashCode Inherited Virtual

Inherited from object

Syntax

public virtual int GetHashCode()

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

public System.Type GetType()

Returns

Type: System.Type

MemberwiseClone Inherited

Inherited from object

Syntax

protected internal object MemberwiseClone()

Returns

Type: object

ReferenceEquals Inherited

Inherited from object

Syntax

public static bool ReferenceEquals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

ToString Override

Returns a string representation of the function import.

Syntax

public override string ToString()

Returns

Type: string A string containing the function import name and function.

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?