Definition
Assembly: Microsoft.OData.Mcp.Core.dll Namespace: Microsoft.OData.Mcp.Core.Models Inheritance: System.ObjectSyntax
Summary
Represents a complete OData Entity Data Model (EDM).Remarks
The EDM defines the structure of data exposed by an OData service, including entity types, complex types, entity containers, and their relationships. This class serves as the root model that contains all metadata necessary to understand and interact with an OData service.Constructors
.ctor
Initializes a new instance of the EdmModel class.Syntax
.ctor
Initializes a new instance of the EdmModel class with the specified version.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
version | string | The version of the EDM. |
Exceptions
| Exception | Description |
|---|---|
ArgumentException | Thrown when version is null or whitespace. |
.ctor Inherited
Inherited from
objectSyntax
Properties
Actions
Gets or sets the actions defined in this model.Syntax
Property Value
Type:System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmAction>
A collection of actions that can be invoked on the service.
Remarks
Actions are operations that may have side effects and are used to modify data or perform operations that cannot be expressed through standard CRUD operations.AllEntitySets
Gets all entity sets from all entity containers.Syntax
Property Value
Type:System.Collections.Generic.IEnumerable<Microsoft.OData.Mcp.Core.Models.EdmEntitySet>
A flattened collection of all entity sets in the model.
AllSingletons
Gets all singletons from all entity containers.Syntax
Property Value
Type:System.Collections.Generic.IEnumerable<Microsoft.OData.Mcp.Core.Models.EdmSingleton>
A flattened collection of all singletons in the model.
Annotations
Gets or sets the annotations for this model.Syntax
Property Value
Type:System.Collections.Generic.Dictionary<string, object>
A dictionary of annotations that provide additional metadata about the model.
Remarks
Annotations can be used to specify additional behaviors, constraints, or metadata that are not captured by the standard OData model elements.ComplexTypes
Gets or sets the complex types defined in this model.Syntax
Property Value
Type:System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmComplexType>
A collection of complex types that define reusable structured data elements.
Remarks
Complex types are structured types without keys that can be used as property types in entity types or other complex types.EntityContainer
Gets the primary entity container for this model (alias for PrimaryContainer).Syntax
Property Value
Type:Microsoft.OData.Mcp.Core.Models.EdmEntityContainer?
The first entity container, or null if no containers are defined.
EntityContainers
Gets or sets the entity containers defined in this model.Syntax
Property Value
Type:System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmEntityContainer>
A collection of entity containers that define the service interface.
Remarks
Entity containers define the addressable resources in the OData service. Typically, there is one primary entity container per service.EntityTypes
Gets or sets the entity types defined in this model.Syntax
Property Value
Type:System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmEntityType>
A collection of entity types that define the structure of entities in the service.
Remarks
Entity types are the primary structural elements in the EDM, defining the properties and relationships that make up the data model.Functions
Gets or sets the functions defined in this model.Syntax
Property Value
Type:System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmFunction>
A collection of functions that can be called on the service.
Remarks
Functions are operations that can be called to retrieve data or perform calculations. They are side-effect free and can be composed with other query operations.HasComplexTypes
Gets a value indicating whether this model has any complex types.Syntax
Property Value
Type:bool
true if the model has complex types; otherwise, false.
HasEntityContainers
Gets a value indicating whether this model has any entity containers.Syntax
Property Value
Type:bool
true if the model has entity containers; otherwise, false.
HasEntityTypes
Gets a value indicating whether this model has any entity types.Syntax
Property Value
Type:bool
true if the model has entity types; otherwise, false.
Namespaces
Gets or sets the namespaces used in this model.Syntax
Property Value
Type:System.Collections.Generic.List<string>
A collection of namespace strings that organize the types in the model.
Remarks
Namespaces provide organizational structure and help avoid naming conflicts between types from different sources.PrimaryContainer
Gets the primary entity container for this model.Syntax
Property Value
Type:Microsoft.OData.Mcp.Core.Models.EdmEntityContainer?
The first entity container, or null if no containers are defined.
Remarks
Most OData services have a single entity container that serves as the primary interface. This property provides convenient access to that container.Version
Gets or sets the version of the EDM.Syntax
Property Value
Type:string
The version string (e.g., “4.0”, “4.01”).
Remarks
This indicates which version of the OData standard the model conforms to. Different versions have different capabilities and syntax.Methods
AddAnnotation
Adds an annotation to this model.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. |
AddComplexType
Adds a complex type to the model.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
complexType | Microsoft.OData.Mcp.Core.Models.EdmComplexType | The complex type to add. |
Exceptions
| Exception | Description |
|---|---|
ArgumentNullException | Thrown when complexType is null. |
InvalidOperationException | Thrown when a complex type with the same full name already exists. |
AddEntityContainer
Adds an entity container to the model.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entityContainer | Microsoft.OData.Mcp.Core.Models.EdmEntityContainer | The entity container to add. |
Exceptions
| Exception | Description |
|---|---|
ArgumentNullException | Thrown when entityContainer is null. |
InvalidOperationException | Thrown when an entity container with the same full name already exists. |
AddEntityType
Adds an entity type to the model.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entityType | Microsoft.OData.Mcp.Core.Models.EdmEntityType | The entity type to add. |
Exceptions
| Exception | Description |
|---|---|
ArgumentNullException | Thrown when entityType is null. |
InvalidOperationException | Thrown when an entity type with the same full name already exists. |
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.
GetComplexType
Gets a complex type by its fully qualified name.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
fullName | string | The fully qualified name of the complex type (namespace.name). |
Returns
Type:Microsoft.OData.Mcp.Core.Models.EdmComplexType?
The complex type with the specified name, or null if not found.
GetComplexType
Gets a complex type by name and namespace.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the complex type. |
namespace | string | The namespace of the complex type. |
Returns
Type:Microsoft.OData.Mcp.Core.Models.EdmComplexType?
The complex type with the specified name and namespace, or null if not found.
GetEntityContainer
Gets an entity container by its fully qualified name.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
fullName | string | The fully qualified name of the entity container (namespace.name). |
Returns
Type:Microsoft.OData.Mcp.Core.Models.EdmEntityContainer?
The entity container with the specified name, or null if not found.
GetEntityContainer
Gets an entity container by name and namespace.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the entity container. |
namespace | string | The namespace of the entity container. |
Returns
Type:Microsoft.OData.Mcp.Core.Models.EdmEntityContainer?
The entity container with the specified name and namespace, or null if not found.
GetEntitySet
Gets an entity set by name from any entity container.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entitySetName | string | The name of the entity set. |
Returns
Type:Microsoft.OData.Mcp.Core.Models.EdmEntitySet?
The entity set with the specified name, or null if not found.
GetEntityType
Gets an entity type by its fully qualified name.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
fullName | string | The fully qualified name of the entity type (namespace.name). |
Returns
Type:Microsoft.OData.Mcp.Core.Models.EdmEntityType?
The entity type with the specified name, or null if not found.
GetEntityType
Gets an entity type by name and namespace.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the entity type. |
namespace | string | The namespace of the entity type. |
Returns
Type:Microsoft.OData.Mcp.Core.Models.EdmEntityType?
The entity type with the specified name and namespace, or null if not found.
GetHashCode Inherited Virtual
Inherited from
objectSyntax
Returns
Type:int
GetSingleton
Gets a singleton by name from any entity container.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
singletonName | string | The name of the singleton. |
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 model.Syntax
Returns
Type:string
A summary of the model contents.
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?
Validate
Validates the model for consistency and completeness.Syntax
Returns
Type:System.Collections.Generic.IEnumerable<string>
A collection of validation errors, or an empty collection if the model is valid.