Skip to main content

Definition

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

Syntax

Microsoft.OData.Mcp.Core.Parsing.CsdlParser

Summary

Parses OData CSDL (Conceptual Schema Definition Language) XML documents into EDM models.

Remarks

This parser handles CSDL XML documents that describe the structure of OData services, including entity types, complex types, entity containers, and their relationships. It supports OData specification versions 4.0 and later.

Constructors

.ctor

Initializes a new instance of the CsdlParser class.

Syntax

public CsdlParser()

.ctor

Initializes a new instance of the CsdlParser class with the specified logger.

Syntax

public CsdlParser(Microsoft.Extensions.Logging.ILogger<Microsoft.OData.Mcp.Core.Parsing.CsdlParser> logger)

Parameters

NameTypeDescription
loggerMicrosoft.Extensions.Logging.ILogger<Microsoft.OData.Mcp.Core.Parsing.CsdlParser>The logger to use for diagnostic messages.

.ctor Inherited

Inherited from object

Syntax

public Object()

Methods

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 Inherited Virtual

Inherited from object

Syntax

public virtual int GetHashCode()

Returns

Type: int

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

ParseFromFile

Parses a CSDL XML document from a file.

Syntax

public Microsoft.OData.Mcp.Core.Models.EdmModel ParseFromFile(string filePath)

Parameters

NameTypeDescription
filePathstringThe path to the file containing the CSDL XML content.

Returns

Type: Microsoft.OData.Mcp.Core.Models.EdmModel The parsed EDM model.

Exceptions

ExceptionDescription
ArgumentExceptionThrown when filePath is null or whitespace.
FileNotFoundExceptionThrown when the file does not exist.
XmlExceptionThrown when the XML is malformed.
InvalidOperationExceptionThrown when the CSDL structure is invalid.

ParseFromStream

Parses a CSDL XML document from a stream.

Syntax

public Microsoft.OData.Mcp.Core.Models.EdmModel ParseFromStream(System.IO.Stream stream)

Parameters

NameTypeDescription
streamSystem.IO.StreamThe stream containing the CSDL XML content.

Returns

Type: Microsoft.OData.Mcp.Core.Models.EdmModel The parsed EDM model.

Exceptions

ExceptionDescription
ArgumentNullExceptionThrown when stream is null.
XmlExceptionThrown when the XML is malformed.
InvalidOperationExceptionThrown when the CSDL structure is invalid.

ParseFromString

Parses a CSDL XML document from a string.

Syntax

public Microsoft.OData.Mcp.Core.Models.EdmModel ParseFromString(string csdlXml)

Parameters

NameTypeDescription
csdlXmlstringThe CSDL XML content as a string.

Returns

Type: Microsoft.OData.Mcp.Core.Models.EdmModel The parsed EDM model.

Exceptions

ExceptionDescription
ArgumentExceptionThrown when csdlXml is null or whitespace.
XmlExceptionThrown when the XML is malformed.
InvalidOperationExceptionThrown when the CSDL structure is invalid.

ReferenceEquals Inherited

Inherited from object

Syntax

public static bool ReferenceEquals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?
  • Microsoft.OData.Mcp.Core.Parsing.ICsdlMetadataParser