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.

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();

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

Clone this wiki locally