5

We want to start using Asp.net web api for our future enterprise services however we do not want to use EF for data access.

Are there any samples out there for Asp.net Web APi working with regular ado.net classes instead of EF?

Thanks.

5
  • EF is a data access technology, specifically an Object Relational Mapper (or ORM). There are others like it (NHibernate, PetaPoco, LLBLGEN, etc.) as well as ADO.NET, etc.. Why are you choosing to stay away from EF? Commented Aug 14, 2012 at 0:49
  • 1
    What are you having trouble with that you need a sample for? Commented Aug 14, 2012 at 0:50
  • Web API is totally independent from data access layer. You probably saw a couple of WEB API samples that happened to work with EF. Just look for ADO.NET examples without WEB API and then think about connect them into WEB API. I believe, however, there would be nobody who tries to work with non-ORM framework like ADO.NET for ASP.NET MVC unless there is a pretty good reason that I can't anticipate. It's like having manual windows in BMW. Commented Aug 14, 2012 at 1:09
  • +1. The issue is that the Visual Studio 2012 template pulls down EF with NuGet, along with some other (EF-dependent) packages that are not needed by all projects. Commented May 14, 2013 at 19:46
  • See stackoverflow.com/questions/14349255/… Commented May 14, 2013 at 20:12

1 Answer 1

3

Are you looking for code samples for how to use e.g., SqlConnection, SqlCommand, SqlDataReader?

You would use the classes in System.Data.SqlClient if you are trying to talk to SQL Server, System.Data.OracleClient if you're trying to talk to Oracle, or System.Data.Odbc if you're trying to talk to MySQL.

Here are some code samples for how to call a stored procedure from ADO.NET. Good luck!

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.