Basically, I have a very good knowledge of plain old SQL coming from Classic ASP
ID: 642685 • Letter: B
Question
Basically, I have a very good knowledge of plain old SQL coming from Classic ASP programming.
Over the past couple of months, I have been learning C# and today was my first full day at MVC 3 (Razor) which I am loving!
I need to get back in to Databases and I know that writing SqlCommand everywhere is obviously outdated (although it is nice I can still do it!).
I used to go to a great usergroup as an IT Pro and the developer stuff went completely over my head, however I do remember a few things which kept coming up such as LINQ... However, that was some time ago and now the same people on Twitter are saying how out dated it is.
I have tried to do research on both and I am clueless as to what direction I should go in, or when to use one over another (if learning both is a good thing).
I am more so confused as I thought EF was a part of the .Net Framework, however, reading through the quick start guide, I had to download a component using Nuget.
... Basically I am out of my depth here and just need some honest advice of where to go!
Explanation / Answer
You should absolutely learn Linq the language. In my project we use it only about 50% of the time to get data in or out of a database. You can just as easily use it against other sources such as XML and objects, both of which we do lots more of.
I assume you're meaning Linq To Sql. It and EF provide very similar functionality in working with databases. We currently use both in various projects. I have a strong background in SQL so I look at both and go, "Meh." I'm not completely sold on either. I don't dislike them, they're fine. But ultimately it's just getting data in or out of a database which can be done in a ton of different ways.
One thing to keep in mind is that both L2S and EF utilize code generation to create their entities. Through T4 you have the ability to do your own code generation, and have it generate your stored procs and data access layer, if you like procs better.
Where I do like L2S and EF is when you need a quick query that joins tables, that creating a stored proc might be overkill for. You can also use it to populate your POCO objects directly in the queries, which is very nice.
Personally, if it's just about getting data in or out of a database use what you know, but do learn Linq for use against other sources of data.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.