Skip to content

LINQ to ReQL Provider

Brian Chavez edited this page May 13, 2016 · 36 revisions

The C# driver offers an experimental LINQ to ReQL driver for those who are looking for a more idiomatic .NET experience when working with RethinkDB. Here's a quick example:

var games = new[]
   {
       new Game {id = 2, Player = "Bob", Points = 15, Type = "ranked"},
       new Game {id = 5, Player = "Alice", Points = 7, Type = "free"},
       new Game {id = 11, Player = "Bob", Points = 10, Type = "free"},
       new Game {id = 12, Player = "Alice", Points = 2, Type = "free"},
   };

// LINQ to ReQL
var results = R.Db("lobby").Table<Game>("games", conn)
    .Where(g => g.Player == "Alice" && g.Points > 5)
    .ToList();

results.Dump();

/* OUTPUT:
[
  {
    "id": 5,
    "Player": "Alice",
    "Points": 7,
    "Type": "free"
  }
]
*/

Getting Started

Download & Install

NuGet Package RethinkDb.Driver.Linq

Install-Package RethinkDb.Driver.Linq -Pre

Indexes

Clone this wiki locally