Giter VIP home page Giter VIP logo

datatableodata's Introduction

Mercato.AspNet.OData.DataTable

Adds support for OData query syntax over ADO.Net DataTables in WebApi projects.

This is an initial implementation to allow for core functionality in cases where there is no fixed structure for the datatable at design time, meaning that use of the standard Microsoft.AspNet.OData nuget is precluded by the lack of a fixed EdmModel or underlying Entity source.

The implementation as it stands currently supports the following elements of the OData syntax:

  • $filter - supporting all standard operators with the exception of has
  • $select - not including support for $expand as there is no concept of related entities
  • $top
  • $skip
  • $orderby

At the time of writing there is no support for functions implemented

Usage

Getting Started

Install-Package Mercato.AspNet.OData.DataTableExtension

This will install the standard Microsoft OData dependencies

OData Initialisation

To correctly intitialise the OData parsing for your API project add the following to your startup:

using Microsoft.AspNet.OData.Extensions;

...

        public static void Register(HttpConfiguration config)
        {
            config.EnableDependencyInjection();

			...
        }

In your controller, once you have your populated DataTable:

using Mercato.AspNet.OData.DataTableExtension;
...

            DataTable BaseData = ....;

            DataTable Output = BaseData.ApplyODataQuery(Request);

Swagger Support

The class ODataParametersSwaggerDefinition adds support for indicating the supported OData parameters in OpenApi (Swagger) documentation using Swashbuckle.

The class implements the IOperationFilter interface to allow use according to the Swashbuckle documentation. In addition a static method is exposed to allow for direct addition of the parameters if building the operation representations manually.

using Mercato.AspNet.OData.DataTableExtension;

…

            Swashbuckle.Swagger.Operation TargetOperation =.;
            ODataParametersSwaggerDefinition.AppendOdataParametersToOperation(TargetOperation);

datatableodata's People

Contributors

markmiddlemist avatar delradie avatar

Stargazers

 avatar Ivan Josipovic avatar

Watchers

James Cloos avatar  avatar

Forkers

bubdm

datatableodata's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.