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.EdmEntityContainer

Summary

Represents an entity container in an OData model.

Remarks

An entity container defines the scope of addressable resources in an OData service. It contains entity sets, singletons, function imports, and action imports that comprise the service’s interface. Each OData service must have exactly one entity container.

Constructors

.ctor

Initializes a new instance of the EdmEntityContainer class.

Syntax

public EdmEntityContainer()

.ctor

Initializes a new instance of the EdmEntityContainer class with the specified name and namespace.

Syntax

public EdmEntityContainer(string name, string namespace)

Parameters

NameTypeDescription
namestringThe name of the entity container.
namespacestringThe namespace of the entity container.

Exceptions

ExceptionDescription
ArgumentExceptionThrown when name or namespace is null or whitespace.

.ctor Inherited

Inherited from object

Syntax

public Object()

Properties

ActionImports

Gets or sets the action imports in this container.

Syntax

public System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmActionImport> ActionImports { get; set; }

Property Value

Type: System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmActionImport> A collection of action imports that expose actions as addressable resources.

Remarks

Action imports allow actions to be called as part of the OData service interface. Unlike functions, actions can have side effects and are typically invoked via POST requests.

Annotations

Gets or sets the annotations for this entity container.

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 entity container.

Remarks

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

EntitySets

Gets or sets the entity sets in this container.

Syntax

public System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmEntitySet> EntitySets { get; set; }

Property Value

Type: System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmEntitySet> A collection of entity sets that define the collections of entities available in the service.

Remarks

Entity sets are the primary addressable resources in an OData service, allowing clients to query, create, update, and delete entities.

Extends

Gets or sets the base entity container.

Syntax

public string Extends { get; set; }

Property Value

Type: string? The fully qualified name of the base entity container, or null if this container has no base.

Remarks

When specified, this entity container extends the base container, inheriting all its entity sets, singletons, and operations. This allows for modular composition of services.

FullName

Gets the fully qualified name of the entity container.

Syntax

public string FullName { get; }

Property Value

Type: string The namespace and name combined with a dot separator.

FunctionImports

Gets or sets the function imports in this container.

Syntax

public System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmFunctionImport> FunctionImports { get; set; }

Property Value

Type: System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmFunctionImport> A collection of function imports that expose functions as addressable resources.

Remarks

Function imports allow functions to be called as part of the OData service interface. They provide a way to expose custom operations that don’t fit the standard CRUD pattern.

HasActionImports

Gets a value indicating whether this entity container has any action imports.

Syntax

public bool HasActionImports { get; }

Property Value

Type: bool true if the entity container has action imports; otherwise, false.

HasBaseContainer

Gets a value indicating whether this entity container extends another container.

Syntax

public bool HasBaseContainer { get; }

Property Value

Type: bool true if the entity container has a base container; otherwise, false.

HasEntitySets

Gets a value indicating whether this entity container has any entity sets.

Syntax

public bool HasEntitySets { get; }

Property Value

Type: bool true if the entity container has entity sets; otherwise, false.

HasFunctionImports

Gets a value indicating whether this entity container has any function imports.

Syntax

public bool HasFunctionImports { get; }

Property Value

Type: bool true if the entity container has function imports; otherwise, false.

HasSingletons

Gets a value indicating whether this entity container has any singletons.

Syntax

public bool HasSingletons { get; }

Property Value

Type: bool true if the entity container has singletons; otherwise, false.

Name

Gets or sets the name of the entity container.

Syntax

public required string Name { get; set; }

Property Value

Type: string The local name of the entity container within its namespace.

Namespace

Gets or sets the namespace of the entity container.

Syntax

public required string Namespace { get; set; }

Property Value

Type: string The namespace that contains this entity container.

Singletons

Gets or sets the singletons in this container.

Syntax

public System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmSingleton> Singletons { get; set; }

Property Value

Type: System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmSingleton> A collection of singletons that define individual entity resources.

Remarks

Singletons represent entities that exist as single instances rather than collections. They are useful for representing unique resources like service configuration or user profiles.

Methods

AddAnnotation

Adds an annotation to this entity container.

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.

AddEntitySet

Adds an entity set to this container.

Syntax

public void AddEntitySet(Microsoft.OData.Mcp.Core.Models.EdmEntitySet entitySet)

Parameters

NameTypeDescription
entitySetMicrosoft.OData.Mcp.Core.Models.EdmEntitySetThe entity set to add.

Exceptions

ExceptionDescription
ArgumentNullExceptionThrown when entitySet is null.
InvalidOperationExceptionThrown when an entity set with the same name already exists.

AddSingleton

Adds a singleton to this container.

Syntax

public void AddSingleton(Microsoft.OData.Mcp.Core.Models.EdmSingleton singleton)

Parameters

NameTypeDescription
singletonMicrosoft.OData.Mcp.Core.Models.EdmSingletonThe singleton to add.

Exceptions

ExceptionDescription
ArgumentNullExceptionThrown when singleton is null.
InvalidOperationExceptionThrown when a singleton with the same name already exists.

Equals Override

Determines whether the specified object is equal to the current entity container.

Syntax

public override bool Equals(object obj)

Parameters

NameTypeDescription
objobject?The object to compare with the current entity container.

Returns

Type: bool true if the specified object is equal to the current entity container; 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

GetActionImport

Gets an action import by name.

Syntax

public Microsoft.OData.Mcp.Core.Models.EdmActionImport GetActionImport(string actionImportName)

Parameters

NameTypeDescription
actionImportNamestringThe name of the action import to retrieve.

Returns

Type: Microsoft.OData.Mcp.Core.Models.EdmActionImport? The action import with the specified name, or null if not found.

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.

GetEntitySet

Gets an entity set by name.

Syntax

public Microsoft.OData.Mcp.Core.Models.EdmEntitySet GetEntitySet(string entitySetName)

Parameters

NameTypeDescription
entitySetNamestringThe name of the entity set to retrieve.

Returns

Type: Microsoft.OData.Mcp.Core.Models.EdmEntitySet? The entity set with the specified name, or null if not found.

GetFunctionImport

Gets a function import by name.

Syntax

public Microsoft.OData.Mcp.Core.Models.EdmFunctionImport GetFunctionImport(string functionImportName)

Parameters

NameTypeDescription
functionImportNamestringThe name of the function import to retrieve.

Returns

Type: Microsoft.OData.Mcp.Core.Models.EdmFunctionImport? The function import with the specified name, or null if not found.

GetHashCode Override

Returns a hash code for the current entity container.

Syntax

public override int GetHashCode()

Returns

Type: int A hash code for the current entity container.

GetHashCode Inherited Virtual

Inherited from object

Syntax

public virtual int GetHashCode()

Returns

Type: int

GetSingleton

Gets a singleton by name.

Syntax

public Microsoft.OData.Mcp.Core.Models.EdmSingleton GetSingleton(string singletonName)

Parameters

NameTypeDescription
singletonNamestringThe name of the singleton to retrieve.

Returns

Type: Microsoft.OData.Mcp.Core.Models.EdmSingleton? The singleton with the specified name, or null if not found.

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 entity container.

Syntax

public override string ToString()

Returns

Type: string The fully qualified name of the entity container.

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?