Convert SQL to linq (automatically)

C

Chris Kennedy

Is there any way to convert fairly basic queries (selects joining across
several tables) into linq? Here's the idea - I use views to act as the basis
for my data access layer (code generated). However I can't use views
directly because they don't use indexes properly (or so I'm told). I just
want to use the views as a place to store select statements. I want to grab
the view definition and convert it to linq and then I can easily add paging.
It doesn't look too hard to convert the select statements into linq as long
as they remain simple and strictly formatted. It's just I was wondering if
anyone had experience (and code) of doing something like this. If the views
get changed then the code generation would break. I am new to this and I am
open to any better ideas.
 
C

Cor Ligthert[MVP]

Hi Chris,

Drag your View into the left Datacontext surface using Server Explorer and
you are almost ready (You open the DataContext by selecting Linq to SQL
from your new items in a project in Solution Explorer)

Cor
 
M

Mikhail Oumantsev

Linqer is SQL to LINQ converter.
Check http://www.sqltolinq.com




Chris Kennedy wrote:

Convert SQL to linq (automatically)
16-Sep-08

Is there any way to convert fairly basic queries (selects joining across
several tables) into linq? Here's the idea - I use views to act as the basis
for my data access layer (code generated). However I can't use views
directly because they don't use indexes properly (or so I'm told). I just
want to use the views as a place to store select statements. I want to grab
the view definition and convert it to linq and then I can easily add paging.
It doesn't look too hard to convert the select statements into linq as long
as they remain simple and strictly formatted. It's just I was wondering if
anyone had experience (and code) of doing something like this. If the views
get changed then the code generation would break. I am new to this and I am
open to any better ideas.

EggHeadCafe - Software Developer Portal of Choice
SumColumn: Custom DataGrid Column that automatically shows Sum/Count/Average in DataGrid Footer.
http://www.eggheadcafe.com/tutorial...33-1248becf3e16/sumcolumn-custom-datagri.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top