views:

458

answers:

2

I've been trying out Subsonic, but I've ran into a problem where I would like to be able to execute CTE towards by SimpleRepository and be able to get my POCOs back from that query.

Is there any way to execute direct SQL in Subsonic 3.0, when using Simplerepository approach?

To explain my problem in Northwind db example: I want to get all Orders that have a Product which belongs in any of these Categories (1,2,3). I just couldn't come up with a nice way of doing this in the SimpleRepository Select or LINQ. With CTE I could do this in few seconds.

Example of this : How to: Directly Execute SQL Queries (LINQ to SQL)

A: 

You can use the CodingHorror method to directly execute SQL:

http://subsonicproject.com/docs/CodingHorror

Adam
+1  A: 

You can use CodingHorror as Adam mentions and from that you can also use ToList or ExecuteTypedList() to get your typed list back.

Rob Conery