0

I'd like some tips on executing some basic table queries into a Sql Server DB using Linq To Sql.

My project is in ASP.NET MVC 4 with c# (using VS2012), but I don't want to write a lot of models and generate entity framework diagrams. I'd like to write manual queries in my controllers, execute them, then convert to a list and return back to my view (i.e. jQuery will parse results and display accordingly).

Background

XML Scenario: My current website project is mostly centered around an XML Request/Response infrastructure. So I'm mostly JQuery calls in c#, and in turn making xml requests into another app server. I then received the xml response and return it to a View. I then parse the xml out and display the contents using jQuery, Datatables, etc.

Database query scenario: One of the QA tools I wrote is actually a Sql Server Procedure based project; however I'm now trying to write a front-end admin tool to execute those QA-based procedures.

So...I'd like to write manual Linq queries directly to my DB and work on the response without generating models. i.e. more of an ad-hoc type query.

In my web.config I have a <connectionStrings> section :

<add name="RegrDBConnection" connectionString="Server=MSSQLSERVER2008;Initial Catalog=RegressionResults;Integrated Security=true" providerName="System.Data.SqlClient" />

1 Answer 1

1

It sounds like you might be in the market for a Micro-ORM. Sam Saffron wrote one for Stack Overflow; it's called Dapper. Rob Conery also wrote one that takes advantage of the dynamic keyword in C# 4.0, called Massive.

Or, you can just go commando and use SQLConnection and SQLCommand objects.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.