Linq and domain objects (Location class)

The way Linq works can be seen in the listing of the complete GetLocations method in Location:

    public static Location[] GetLocations()
    {
      var query = from l in QueryFactory.CreateLinqQuery<Location>()
                  select l;
      return query.ToArray();
    }

This roughly corresponds to the SQL-query

SELECT * FROM Location;

If you are new to Linq, there is bad news and good news:

  • bad: Linq is not explained in this wiki
  • good: very little Linq-knowledge can get you very good
    results in re-motion

If you DO know Linq, QueryFactory.CreateLinqQuery<Location>() will be unfamiliar to you.

This roughly corresponds to Microsoft Linq's DataContext, but has slightly different semantics. re-store comes with its own Linq-provider (re-linq). It is specialized on re-store's data repository and domain objects. Apart from that, re-linq queries can be constructed and work like regular Linq queries. (If you are interested in how this fancy programming works, look no further than the team blog on the subject.