Definition
Assembly: Microsoft.OData.Mcp.Core.dll Namespace: Microsoft.OData.Mcp.Core.Parsing Inheritance: System.ObjectSyntax
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
.ctor
Initializes a new instance of the CsdlParser class with the specified logger.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
logger | Microsoft.Extensions.Logging.ILogger<Microsoft.OData.Mcp.Core.Parsing.CsdlParser> | The logger to use for diagnostic messages. |
.ctor Inherited
Inherited from
objectSyntax
Methods
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
GetHashCode Inherited Virtual
Inherited from
objectSyntax
Returns
Type:int
GetType Inherited
Inherited from
objectSyntax
Returns
Type:System.Type
MemberwiseClone Inherited
Inherited from
objectSyntax
Returns
Type:object
ParseFromFile
Parses a CSDL XML document from a file.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
filePath | string | The path to the file containing the CSDL XML content. |
Returns
Type:Microsoft.OData.Mcp.Core.Models.EdmModel
The parsed EDM model.
Exceptions
| Exception | Description |
|---|---|
ArgumentException | Thrown when filePath is null or whitespace. |
FileNotFoundException | Thrown when the file does not exist. |
XmlException | Thrown when the XML is malformed. |
InvalidOperationException | Thrown when the CSDL structure is invalid. |
ParseFromStream
Parses a CSDL XML document from a stream.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
stream | System.IO.Stream | The stream containing the CSDL XML content. |
Returns
Type:Microsoft.OData.Mcp.Core.Models.EdmModel
The parsed EDM model.
Exceptions
| Exception | Description |
|---|---|
ArgumentNullException | Thrown when stream is null. |
XmlException | Thrown when the XML is malformed. |
InvalidOperationException | Thrown when the CSDL structure is invalid. |
ParseFromString
Parses a CSDL XML document from a string.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
csdlXml | string | The CSDL XML content as a string. |
Returns
Type:Microsoft.OData.Mcp.Core.Models.EdmModel
The parsed EDM model.
Exceptions
| Exception | Description |
|---|---|
ArgumentException | Thrown when csdlXml is null or whitespace. |
XmlException | Thrown when the XML is malformed. |
InvalidOperationException | Thrown when the CSDL structure is invalid. |
ReferenceEquals Inherited
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
Returns
Type:bool
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?
Related APIs
- Microsoft.OData.Mcp.Core.Parsing.ICsdlMetadataParser