Telerik blogs

LinqPad is a nice and popular query analyzer made to test LINQ queries: whether it is Linq To Sql, Linq to Objects or some other flavor, you will be able to play in a nice way with it. Sadly it does not support Telerik OpenAccess ORM out of the box.

However we never said it is impossible – you just have to put some more pressure to it. So, the first step is of course to deploy Telerik OpenAccess ORM and LinqPad on your machine. Then do the following:

a) Open LinqPad and press F4 to bring up the Advanced Query Dialog (this is available also through the Query main menu).

Add references to the OpenAccess assemblies that you need, our data context assembly and the model that will be used to run the queries against.
The list should look like:


Where the Model.dll contains the model from our SilverLight integration demo (available here). We used the sample model because of practical reasons: It has IQueriable endpoints developed on the data context and it is already tested with Ado.Net Data Services. Our context implementation that currently serves Data Services is inside the Telerik.OpenAccess.40.dll. Actually we added references to the DataServices as well, because the Telerik.OpenAccess.40.dll is built with references to them.

So after we have the references in place, it is time to add few namespaces that will allow LinqPad to resolve correctly the types and extents used in our sample query:



You may want to click the "Set as default for new queries" button in the lower left so you don't need to set up these assembly and namespace references the next time you start LINQPad. Alternatively, when you save a * .linq query file it will save these references and reload them the next time you open the .linq query file. This can be handy for switching between different databases and data contexts.

All the connection maintenance is done in the model assembly (those are our assumptions).

In LINQPad, change the query type to "C# Statement(s)" and paste the following sample code:


OADataContext ctx = new OADataContext();

var q = from c in ctx.Orders
        select c;

Press F5 or Ctrl+E to run this and you should see the result:



One additional thing that remains unsolved is the generated SQL dump, and that is what we will look into very soon.


Comments are disabled in preview mode.