Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recommendations for C# database access

Hi I've programmed a fair bit of C#, but never with a database. I'd like to use SQL Server with C# with some framework. Microsoft seems to have shipped a number of frameworks through the lifetime of C#. This makes it difficult for me to search/choose.

Which one should I choose? I'm developing a simple 3-tier webapp. I've watched a few Entity Framework .Net 4.0 videos, but I get the feeling that things are too automatic. I need to do some SQL now and then..

And if I should go for the EF4.0, is this really the best reference http://msdn.microsoft.com/en-us/library/bb386876.aspx

Any recommendations?

like image 841
Carlo V. Dango Avatar asked Mar 12 '11 17:03

Carlo V. Dango


2 Answers

Go with Entity Framework 4 - it is the current and future best approach to SQL Server database. It is the basis for WCF Data Services, and the idea of a conceptual model will show up in other Microsoft product, for sure (Reporting Services and others, possibly).

And it does give you a lot of hooks to allow you to execute "on the fly" SQL statements, and you can also integrate stored procedures very nicely into Entity Framework.

And for the "run of the mill" everyday tasks, it gives you nice C# objects - based on your database - to work with.

In my opinion, this is your best choice currently - and the one with the most flexibility and options. You can start with a database ("database first") and create your classes from existing tables; or you can start with a model and have EF4 generate your database for you, and EF v4.1 (due out pretty soon) will also offer "code-first" development where you don't even need a visual model but you can describe all your database objects and settings in just C# code.

Update:

  • Entity Framework 4 Overview
  • Learn Entity Framework - the site accompanying the book by the same name, by Julie Lerman, Goddess of EF :-)
  • ADO.NET team blog with lots of good EF stuff
  • Entity Framework team design blog
  • ASP.NET 4.0 and the Entity Framework 4 - Part 1 - Create a Database using Model-First Development - good intro for EF4 model-first approach; Vince has multiple articles here - click on his name to get a list of all his articles (many new ones EF4 related)
  • Introduction to Entity Framework (this was for v1 - but still good)
like image 52
marc_s Avatar answered Sep 25 '22 01:09

marc_s


C#+ActiveRecord+NHibernate. Hide the implementation behind several WCF services.

like image 39
Ritch Melton Avatar answered Sep 25 '22 01:09

Ritch Melton