Microsoft.OData.Edm 8.2.4

Prefix Reserved
dotnet add package Microsoft.OData.Edm --version 8.2.4
                    
NuGet\Install-Package Microsoft.OData.Edm -Version 8.2.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.OData.Edm" Version="8.2.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.OData.Edm" Version="8.2.4" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.OData.Edm" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Microsoft.OData.Edm --version 8.2.4
                    
#r "nuget: Microsoft.OData.Edm, 8.2.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Microsoft.OData.Edm&version=8.2.4
                    
Install as a Cake Addin
#tool nuget:?package=Microsoft.OData.Edm&version=8.2.4
                    
Install as a Cake Tool

Microsoft.OData.Edm

The Microsoft.OData.Edm library provides APIs to build, parse, and validate Entity Data Model (EDM) that conform to the OData protocol. It is a core component of the OData .NET libraries, enabling you to work with OData metadata.

Think of it as the schema that describes the kind of data your service exposes. The Microsoft.OData.Edm library, also known as EdmLib, provides classes and interfaces for working with OData models. It includes classes for reading/parsing a schema file in CSDL in XML or JSON formats, writing such files (CsdlReader and CsdlWriter), as well as creating a model directly in-memory (EdmModel).

The IEdmModel interface is used extensively across OData libraries as it provides the base layer for retrieving information about the types and functionality exposed by an OData service.

The EdmModel class (which implements the IEdmModel interface) allows you to manually create a model/schema in memory.

Installation

You can install the Microsoft.OData.Edm package via NuGet:

dotnet add package Microsoft.OData.Edm

Or via the NuGet Package Manager Console:

Install-Package Microsoft.OData.Edm

Getting Started

Creating an EDM Model

Here's a simple example of how to create an EDM model using Microsoft.OData.Edm:

using Microsoft.OData.Edm;
using System;

namespace EdmLibSample;

public class SampleModelBuilder
{
    public static IEdmModel GetEdmModel()
    {
        // Create an empty model
        var model = new EdmModel();

        // Define an entity type
        var productType = new EdmEntityType("NS", "Product");
        productType.AddKeys(productType.AddStructuralProperty("ID", EdmPrimitiveTypeKind.Int32));
        productType.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String);
        model.AddElement(productType);

        // Define an entity container
        var container = new EdmEntityContainer("NS", "Container");
        model.AddElement(container);

        // Define an entity set
        var products = container.AddEntitySet("Products", productType);

        // Output the model
        Console.WriteLine("EDM Model created successfully.");

        return model;
    }
}

Parsing an EDM Model

You can also parse an EDM model from a CSDL (Common Schema Definition Language) document:

using Microsoft.OData.Edm.Csdl;
using Microsoft.OData.Edm;
using System.Xml;

string csdl = @"
<edmx:Edmx Version=""4.0"" xmlns:edmx=""http://docs.oasis-open.org/odata/ns/edmx"">
  <edmx:DataServices>
    <Schema Namespace=""NS"" xmlns=""http://docs.oasis-open.org/odata/ns/edm"">
        <EntityType Name='Product'>
            <Key>
                <PropertyRef Name='ID' />
            </Key>
            <Property Name='ID' Type='Edm.Int32' Nullable='false' />
            <Property Name='Name' Type='Edm.String' />
        </EntityType>
        <EntityContainer Name='Container'>
            <EntitySet Name='Products' EntityType='NS.Product' />
        </EntityContainer>
    </Schema>
  </edmx:DataServices>
</edmx:Edmx>";

IEdmModel model;
using (var reader = XmlReader.Create(new StringReader(csdl)))
{
    model = CsdlReader.Parse(reader);
    Console.WriteLine("EDM Model parsed successfully.");
}

Documentation

For more detailed information, please refer to the official documentation.

Community

Contribution

There are many ways for you to contribute to OData .NET. The easiest way is to participate in discussion of features and issues. You can also contribute by sending pull requests of features or bug fixes to us. Contribution to the documentations is also highly welcomed. Please refer to the CONTRIBUTING.md for more details.

Reporting Security Issues

Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) secure@microsoft.com. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the Security TechCenter.

5.3 Support

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (124)

Showing the top 5 NuGet packages that depend on Microsoft.OData.Edm:

Package Downloads
Microsoft.OData.Core

Classes to serialize, deserialize and validate OData JSON payloads. Supports OData v4 and v4.01. Enables construction of OData services and clients. Targets .NET 8 or above. OData .NET library is open source at http://github.com/OData/odata.net. Documentation for the library can be found at https://docs.microsoft.com/en-us/odata/.

Microsoft.AspNetCore.OData

This package contains everything you need to create OData v4.0 endpoints using ASP.NET Core MVC Core 8.x to support OData query syntax for your Web APIs.

Microsoft.OData.ModelBuilder

This package contains APIs to create OData Edm (Entity Data Model) using C# types, attributes and conventions.

Swashbuckle.OData

Extends Swashbuckle with OData v4 support! Supports both WebApi and OData controllers!

Microsoft.OpenApi.OData

This package contains the codes you need to convert OData CSDL to Open API Document of Model.

GitHub repositories (31)

Showing the top 20 popular GitHub repositories that depend on Microsoft.OData.Edm:

Repository Stars
smartstore/SmartStoreNET
Open Source ASP.NET MVC Enterprise eCommerce Shopping Cart Solution
pnp/PnP
SharePoint / Office 365 Developer Patterns and Practices - Archived older solutions. Please see https://aka.ms/m365pnp for updated guidance
microsoft/OpenAPI.NET
The OpenAPI.NET SDK contains a useful object model for OpenAPI documents in .NET along with common serializers to extract raw OpenAPI JSON and YAML documents from the model.
Azure/data-api-builder
Data API builder provides modern REST and GraphQL endpoints to your Azure Databases and on-prem stores.
OfficeDev/TrainingContent
Training Content used for developer.microsoft.com/office
OData/WebApi
OData Web API: A server library built upon ODataLib and WebApi
OData/odata.net
ODataLib: Open Data Protocol - .NET Libraries and Frameworks
OData/AspNetCoreOData
ASP.NET Core OData: A server library built upon ODataLib and ASP.NET Core
OData/RESTier
A turn-key library for building RESTful services
telerik/xaml-sdk
The XAML SDK is an easy-to-use infrastructure with 1000+ developer focused examples for most of the Telerik UI for WPF controls.
microsoft/BotFramework-BlogSamples
Welcome to the Bot Framework samples repository. Here you will find sample bots that take advantage of Bot Framework capabilities.
rstropek/Samples
filipw/apress-recipes-webapi
Samples from ASP.NET Web API 2: Recipes book.
OData/ODataSamples
Samples: For ODataLib, OData Web API, RESTier, etc.
microsoft/Dynamics-AX-Integration
Dynamics AX Integration samples and demos.
ShaneK2/inVtero.net
inVtero.net: A high speed (Gbps) Forensics, Memory integrity & assurance. Includes offensive & defensive memory capabilities. Find/Extract processes, hypervisors (including nested) in memory dumps using microarchitechture independent Virtual Machiene Introspection techniques
zLulus/NotePractice
My_Note 笔记练习demo
Azure/azure-stream-analytics
Azure Stream Analytics
microsoft/OpenAPI.NET.OData
Generates OpenAPI document from OData CSDL
martin-nikolov/Telerik-Academy
Course exercises | Telerik Academy 2013/2014 | Martin Nikolov
Version Downloads Last Updated
8.2.4 2,382 6/24/2025
8.2.3 1,751,987 12/11/2024
8.2.2 654,689 11/19/2024
8.2.1 23,500 11/13/2024
8.2.0 188,168 11/8/2024
8.1.0 493,393 10/17/2024
8.0.2 121,669 9/30/2024
8.0.1 1,810,005 8/19/2024
8.0.0 1,164,562 8/12/2024
8.0.0-rc.1 3,920 7/11/2024
8.0.0-preview.3 2,518 5/31/2024
8.0.0-preview.2 1,465 5/3/2024
8.0.0-preview.1 346 4/26/2024
7.21.7 1,026 6/23/2025
7.21.6 826,081 11/8/2024
7.21.5 171,492 10/22/2024
7.21.4 108,725 9/30/2024
7.21.3 1,379,008 6/3/2024
7.21.2 142,831 5/23/2024
7.21.1 353,602 5/2/2024
7.21.0 230,472 4/17/2024
7.20.0 8,083,211 12/8/2023
7.19.0 96,848 11/30/2023
7.18.0 1,187,000 9/6/2023
7.17.0 1,722,604 6/23/2023
7.16.0 5,813,554 5/16/2023
7.15.0 2,414,733 3/1/2023
7.14.1 108,689 2/15/2023
7.14.0 476,681 1/11/2023
7.13.0 1,574,070 12/9/2022
7.12.5 4,424,325 10/25/2022
7.12.4 107,328 10/18/2022
7.12.3 387,786 9/19/2022
7.12.2 3,346,594 8/12/2022
7.12.1 331,840 7/20/2022
7.12.0 374,136 6/21/2022
7.11.1 96,688 6/16/2022
7.10.0 2,422,305 1/31/2022
7.9.4 10,265,862 11/5/2021
7.9.3 199,965 10/8/2021
7.9.2 578,096 9/14/2021
7.9.1 140,656 8/26/2021
7.9.0 7,380,502 5/12/2021
7.8.3 1,255,896 3/3/2021
7.8.2 3,499,707 2/15/2021
7.8.1 1,021,550 12/18/2020
7.7.3 1,021,804 11/12/2020
7.7.2 935,547 9/23/2020
7.7.1 2,873,327 9/1/2020
7.7.0 762,384 6/26/2020
7.7.0-beta 6,690 5/29/2020
7.6.4 25,138,616 3/25/2020
7.6.3 1,242,435 1/30/2020
7.6.2 451,164 11/21/2019
7.6.1 6,950,458 9/30/2019
7.6.1-beta 3,699 9/18/2019
7.6.0 1,414,650 6/5/2019
7.6.0-beta 23,034 4/1/2019
7.5.4 806,003 2/15/2019
7.5.3 771,251 12/19/2018
7.5.2 207,374 11/20/2018
7.5.1 747,387 9/17/2018
7.5.0 31,974,500 6/27/2018
7.4.4 555,728 4/4/2018
7.4.3 83,457 3/21/2018
7.4.1 232,643 2/16/2018
7.4.0 1,624,048 1/22/2018
7.4.0-beta3 7,430 1/12/2018
7.4.0-beta2 4,850 12/18/2017
7.4.0-beta 6,591 11/2/2017
7.3.1 712,726 8/14/2017
7.3.0 69,672 7/24/2017
7.3.0-beta 4,019 7/17/2017
7.2.0 973,964 5/3/2017
7.1.1 193,340 4/11/2017
7.0.0 1,111,867 8/22/2016
7.0.0-beta 4,241 8/4/2016
6.19.0 719,034 11/14/2017
6.18.0 128,224 9/7/2017
6.18.0-beta 11,315 7/27/2017
6.17.0 478,913 6/12/2017
6.16.0 214,736 4/3/2017
6.16.0-beta 4,220 1/13/2017
6.15.0 4,027,015 3/18/2016
6.15.0-beta 9,133 1/25/2016
6.14.0 559,288 12/15/2015
6.14.0-rc2 4,428 12/2/2015
6.14.0-rc 7,086 10/30/2015
6.14.0-beta 3,909 10/16/2015
6.13.0 1,463,957 7/22/2015
6.13.0-rc 4,088 7/14/2015
6.13.0-beta 4,188 6/19/2015
6.12.0 362,706 5/22/2015
6.12.0-beta 4,256 5/15/2015
6.11.0 764,182 3/30/2015
6.10.0 254,517 2/6/2015
6.9.0 629,319 12/10/2014
6.8.1 370,084 10/20/2014
6.8.0 26,343 9/23/2014
6.7.0 37,006 8/29/2014
6.6.0 24,148 7/31/2014
6.5.0 114,997 6/30/2014
6.4.0 287,246 5/30/2014
6.3.0 12,166 4/28/2014
6.2.0 8,003 4/1/2014
6.1.0 5,847 3/4/2014
6.0.0 88,078 1/27/2014
6.0.0-beta1 7,071 12/9/2013
6.0.0-alpha2 4,316 11/7/2013
6.0.0-alpha1 4,055 10/4/2013