Coder Social home page Coder Social logo

re-motion / relinq Goto Github PK

View Code? Open in Web Editor NEW
514.0 34.0 60.0 7.53 MB

With re-linq, it's now easier than ever to create full-featured LINQ providers. Used by NHibernate, Entity Framework and others.

Home Page: https://www.re-motion.org

C# 99.83% PowerShell 0.03% Batchfile 0.14%

relinq's Introduction

Project Description With re-linq, it's now easier than ever to create full-featured LINQ providers.

Yes, you've heard that before. But re-linq is the real thing: it is used by Entity Framework 7 and NHibernate.

  • Instead of the IQueryable expression tree, re-linq gives you an abstract syntax tree that resembles the original LINQ query expression (the one using the from, where etc. keywords).
    • This works even when the original query was not a query expression, but a sequence of method invocations of Where(), Select() etc.
    • You can easily extend or modify quieries using this representation in your application, directly or via a Specification framework.
  • In the process, re-linq gets rid of everything that IQueryable puts between you and your desired target query language:
    • The structure is simplified (e.g., SelectMany is transformed back to multiple from-sources).
    • Transparent identifiers are removed.
    • Sub-queries are identified and can be handled as such.
    • Expressions are evaluated up-front wherever possible.
    • Special method calls inserted by Visual Basic are "normalized" so that they are handled implicitly, except if you choose to handle them differently.
  • re-linq handles even the most complex LINQ query expression, including joins, groups and nested queries.
  • re-linq gives you the tools to easily create your own provider, including:
    • A set of visitors that you just implement for your transformation.
    • A registry for translating methods to specific expressions in the target query language (like string methods, or ICollection.Contains).
    • A mechanism to specify eager fetching for related objects or collections that will automatically create the required queries.
  • re-linq is completely agnostic of the target query language. You can use it to create any dialect of SQL as well as other query languages such as XQL or Entity SQL. For instance, the NHibernate project uses re-linq to create HQL ASTs.

Depending on the differences between LINQ and the target query language you want to address, there is probably still a major piece of work ahead of you. But with re-linq this is about as simple as it can be: just what you thought was ahead of you before you discovered the internals of IQueryable, and then some more help.

There's one more potential advantage: The remaining effort is probably mostly in the semantic transformation from LINQ to the target query language, especially in cases where the target language does not support certain LINQ constructs (like sub-queries or LINQ group joins). Also, certain optimizations need to be made, e.g. in order to avoid the select n+1 problem via eager fetching. In many cases, the necessary transformations are similar between various target languages. re-linq allows you to do these transformations in its own query model representation, before you actually translate to the target language. These transformations can be shared between different LINQ providers via the re-motion contrib repository.

re-linq is part of the re-motion project. See the project home page for more interesting libraries, such as re-mix.

Ressources

Related Projects

Sources The most current source code of re-linq is available on GitHub:

Binaries The re-linq releases are distributed as NuGet packages:

Versioning Starting with version 2.0, the releases follow Semantic Versioning (http://semver.org/)

License The Remotion.Linq.dll (the "Frontend") is licensed under the Apache Software License 2.0.

Contributing We have official contribution practices documented: Contributing to re-linq

relinq's People

Contributors

anpete avatar davidelettieri avatar drauch avatar fschmied avatar gordonwatts avatar iam-mholle avatar michaelketting avatar stefan-wenig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.