Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.
IharYakimush edited this page Mar 1, 2018 · 8 revisions

Welcome to the Comminity.OData.Linq wiki!

Use OData text query in linq expresson for any IQuerable without ASP.NET dependency

Currently supported parameters:

  • $filter
  • $orderby
  • $select
  • $expand

Supported platforms:

  • netstandard2.0
  • net45

Nuget packages

Getting started code sample:


    using System;
    using System.Linq;

    using Community.OData.Linq;

    public class Entity
    {
        public int Id { get; set; }

        public string Name { get; set; }
    }

    public static class GetStartedDemo
    {
        public static void Demo()
        {
            Entity[] items =
                {
                    new Entity { Id = 1, Name = "n1" },
                    new Entity { Id = 2, Name = "n2" },
                    new Entity { Id = 3, Name = "n3" }
                };
            IQueryable<Entity> query = items.AsQueryable();

            var result = query.OData().Filter("Id eq 1 or Name eq 'n3'").OrderBy("Name desc").ToArray();

            // Id: 3 Name: n3
            // Id: 1 Name: n1
            foreach (Entity entity in result)
            {
                Console.WriteLine("Id: {0} Name: {1}", entity.Id, entity.Name);
            }
        }
    }

Clone this wiki locally