Definition
Assembly: Microsoft.OData.Mcp.Core.dll Namespace: Microsoft.OData.Mcp.Core.Models Inheritance: System.ObjectSyntax
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
.ctor
Initializes a new instance of the EdmFunctionImport class with the specified name and function.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the function import. |
function | string | The fully qualified name of the function being imported. |
Exceptions
| Exception | Description |
|---|---|
ArgumentException | Thrown when name or function is null or whitespace. |
.ctor Inherited
Inherited from
objectSyntax
Properties
Annotations
Gets or sets the annotations for this function import.Syntax
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
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
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
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
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
Parameters
| Name | Type | Description |
|---|---|---|
term | string | The annotation term. |
value | object | The annotation value. |
Exceptions
| Exception | Description |
|---|---|
ArgumentException | Thrown when term is null or whitespace. |
Equals Override
Determines whether the specified object is equal to the current function import.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
obj | object? | 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
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
obj | object? | - |
Returns
Type:bool
Equals Inherited
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
Returns
Type:bool
GetAnnotation
Gets an annotation value by term.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
term | string | The 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
Returns
Type:int
A hash code for the current function import.
GetHashCode Inherited Virtual
Inherited from
objectSyntax
Returns
Type:int
GetType Inherited
Inherited from
objectSyntax
Returns
Type:System.Type
MemberwiseClone Inherited
Inherited from
objectSyntax
Returns
Type:object
ReferenceEquals Inherited
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
Returns
Type:bool
ToString Override
Returns a string representation of the function import.Syntax
Returns
Type:string
A string containing the function import name and function.
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?