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

Summary

Represents an entity type in an OData model.

Remarks

Entity types define the structure of entities in an OData service, including their properties, navigation properties, and key definitions. They form the foundation of the entity data model and determine how data is structured and accessed.

Constructors

.ctor

Initializes a new instance of the EdmEntityType class.

Syntax

public EdmEntityType()

.ctor

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

Syntax

public EdmEntityType(string name, string namespace)

Parameters

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

Exceptions

ExceptionDescription
ArgumentExceptionThrown when name or namespace is null or whitespace.

.ctor Inherited

Inherited from object

Syntax

public Object()

Properties

Abstract

Gets or sets a value indicating whether this entity type is abstract.

Syntax

public bool Abstract { get; set; }

Property Value

Type: bool true if the entity type is abstract; otherwise, false.

Remarks

Abstract entity types cannot be instantiated directly but can serve as base types for other entity types. They are useful for defining common properties and behaviors.

BaseType

Gets or sets the base type of the entity type.

Syntax

public string BaseType { get; set; }

Property Value

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

Remarks

When specified, this entity type inherits all properties and navigation properties from the base type. The inheritance hierarchy must be consistent within the model.

FullName

Gets the fully qualified name of the entity type.

Syntax

public string FullName { get; }

Property Value

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

HasBaseType

Gets a value indicating whether this entity type inherits from another entity type.

Syntax

public bool HasBaseType { get; }

Property Value

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

HasNavigationProperties

Gets a value indicating whether this entity type has any navigation properties.

Syntax

public bool HasNavigationProperties { get; }

Property Value

Type: bool true if the entity type has navigation properties; otherwise, false.

HasStream

Gets or sets a value indicating whether this entity type has a stream.

Syntax

public bool HasStream { get; set; }

Property Value

Type: bool true if the entity type has a stream; otherwise, false.

Remarks

When true, instances of this entity type can have an associated media resource (such as a photo or document) that can be accessed via streaming operations.

IsAbstract

Gets a value indicating whether this entity type is abstract.

Syntax

public bool IsAbstract { get; }

Property Value

Type: bool true if the entity type is abstract; otherwise, false.

Remarks

This is an alias for the EdmEntityType.Abstract property for compatibility.

Key

Gets or sets the key properties of the entity type.

Syntax

public System.Collections.Generic.List<string> Key { get; set; }

Property Value

Type: System.Collections.Generic.List<string> A collection of property names that form the entity key.

Remarks

Key properties uniquely identify instances of the entity type. They are used for addressing individual entities and establishing relationships.

KeyProperties

Gets the key properties as EdmProperty objects.

Syntax

public System.Collections.Generic.IEnumerable<Microsoft.OData.Mcp.Core.Models.EdmProperty> KeyProperties { get; }

Property Value

Type: System.Collections.Generic.IEnumerable<Microsoft.OData.Mcp.Core.Models.EdmProperty> A collection of properties that form the entity key.

Name

Gets or sets the name of the entity type.

Syntax

public required string Name { get; set; }

Property Value

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

Namespace

Gets or sets the namespace of the entity type.

Syntax

public required string Namespace { get; set; }

Property Value

Type: string The namespace that contains this entity type. Gets or sets the navigation properties of the entity type.

Syntax

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

Property Value

Type: System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmNavigationProperty> A collection of navigation properties that define relationships to other entities.

Remarks

Navigation properties enable traversal between related entities and define the relationship structure of the data model.

NonKeyProperties

Gets the non-key properties of the entity type.

Syntax

public System.Collections.Generic.IEnumerable<Microsoft.OData.Mcp.Core.Models.EdmProperty> NonKeyProperties { get; }

Property Value

Type: System.Collections.Generic.IEnumerable<Microsoft.OData.Mcp.Core.Models.EdmProperty> A collection of properties that are not part of the entity key.

OpenType

Gets or sets a value indicating whether this entity type is open.

Syntax

public bool OpenType { get; set; }

Property Value

Type: bool true if the entity type is open; otherwise, false.

Remarks

Open entity types allow additional properties beyond those explicitly defined in the metadata. This provides flexibility for dynamic scenarios where the complete structure may not be known at design time.

Properties

Gets or sets the properties of the entity type.

Syntax

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

Property Value

Type: System.Collections.Generic.List<Microsoft.OData.Mcp.Core.Models.EdmProperty> A collection of structural properties that define the data elements of the entity.

Remarks

These properties represent the data that can be stored and retrieved for instances of this entity type. They include both key and non-key properties.

Methods

Equals Override

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

Syntax

public override bool Equals(object obj)

Parameters

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

Returns

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

GetHashCode Override

Returns a hash code for the current entity type.

Syntax

public override int GetHashCode()

Returns

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

GetHashCode Inherited Virtual

Inherited from object

Syntax

public virtual int GetHashCode()

Returns

Type: int

GetNavigationProperty

Gets a navigation property by name.

Syntax

public Microsoft.OData.Mcp.Core.Models.EdmNavigationProperty GetNavigationProperty(string propertyName)

Parameters

NameTypeDescription
propertyNamestringThe name of the navigation property to retrieve.

Returns

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

GetProperty

Gets a property by name.

Syntax

public Microsoft.OData.Mcp.Core.Models.EdmProperty GetProperty(string propertyName)

Parameters

NameTypeDescription
propertyNamestringThe name of the property to retrieve.

Returns

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

GetType Inherited

Inherited from object

Syntax

public System.Type GetType()

Returns

Type: System.Type

HasNavigationProperty

Determines whether the entity type has a navigation property with the specified name.

Syntax

public bool HasNavigationProperty(string propertyName)

Parameters

NameTypeDescription
propertyNamestringThe name of the navigation property to check.

Returns

Type: bool true if the entity type has the navigation property; otherwise, false.

HasProperty

Determines whether the entity type has a property with the specified name.

Syntax

public bool HasProperty(string propertyName)

Parameters

NameTypeDescription
propertyNamestringThe name of the property to check.

Returns

Type: bool true if the entity type has the property; otherwise, false.

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

Syntax

public override string ToString()

Returns

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

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?