Skip to main content

Definition

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

Syntax

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

Exceptions

.ctor Inherited

Inherited from object

Syntax

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

Exceptions

AddComplexType

Adds a complex type to the model.

Syntax

Parameters

Exceptions

AddEntityContainer

Adds an entity container to the model.

Syntax

Parameters

Exceptions

AddEntityType

Adds an entity type to the model.

Syntax

Parameters

Exceptions

Equals Inherited Virtual

Inherited from object

Syntax

Parameters

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

GetAnnotation

Gets an annotation value by term.

Syntax

Parameters

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

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

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

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

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

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

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

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 object

Syntax

Returns

Type: int

GetSingleton

Gets a singleton by name from any entity container.

Syntax

Parameters

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

Returns

Type: System.Type

MemberwiseClone Inherited

Inherited from object

Syntax

Returns

Type: object

ReferenceEquals Inherited

Inherited from object

Syntax

Parameters

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 object

Syntax

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.