Definition
Assembly: Microsoft.OData.Mcp.Core.dll Namespace: Microsoft.OData.Mcp.Core.Models Inheritance: System.ObjectSyntax
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
.ctor
Initializes a new instance of the EdmEntityContainer class with the specified name and namespace.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the entity container. |
namespace | string | The namespace of the entity container. |
Exceptions
| Exception | Description |
|---|---|
ArgumentException | Thrown when name or namespace is null or whitespace. |
.ctor Inherited
Inherited from
objectSyntax
Properties
ActionImports
Gets or sets the action imports in this container.Syntax
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
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
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
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
Property Value
Type:string
The namespace and name combined with a dot separator.
FunctionImports
Gets or sets the function imports in this container.Syntax
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
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
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
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
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
Property Value
Type:bool
true if the entity container has singletons; otherwise, false.
Name
Gets or sets the name of the entity container.Syntax
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
Property Value
Type:string
The namespace that contains this entity container.
Singletons
Gets or sets the singletons in this container.Syntax
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
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. |
AddEntitySet
Adds an entity set to this container.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entitySet | Microsoft.OData.Mcp.Core.Models.EdmEntitySet | The entity set to add. |
Exceptions
| Exception | Description |
|---|---|
ArgumentNullException | Thrown when entitySet is null. |
InvalidOperationException | Thrown when an entity set with the same name already exists. |
AddSingleton
Adds a singleton to this container.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
singleton | Microsoft.OData.Mcp.Core.Models.EdmSingleton | The singleton to add. |
Exceptions
| Exception | Description |
|---|---|
ArgumentNullException | Thrown when singleton is null. |
InvalidOperationException | Thrown when a singleton with the same name already exists. |
Equals Override
Determines whether the specified object is equal to the current entity container.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
obj | object? | 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
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
GetActionImport
Gets an action import by name.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
actionImportName | string | The 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
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.
GetEntitySet
Gets an entity set by name.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entitySetName | string | The 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
Parameters
| Name | Type | Description |
|---|---|---|
functionImportName | string | The 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
Returns
Type:int
A hash code for the current entity container.
GetHashCode Inherited Virtual
Inherited from
objectSyntax
Returns
Type:int
GetSingleton
Gets a singleton by name.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
singletonName | string | The 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
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 entity container.Syntax
Returns
Type:string
The fully qualified name of the entity container.
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?