Practical .NET

Not Using LINQ Yet? Here's a Few Reasons Why.

Peter Vogel introduces a new column on application development in the real world, and begins by advocating for Language Integrated Query.

Microsoft and magazines like this one have been telling you to adopt LINQ and Entity Framework for what seems like years. The main reason that you haven't done so is, probably, because you're smart. Smart developers build up a body of what I call "programmer lore" -- all the knowledge that you accumulate while you build applications in a particular technology. This includes all the standard solutions you keep in your mental toolbox, the generalized code you use in multiple applications, the cut-and-paste code you move from one program to another, and more. Programmer lore is knowing what the compiler's error messages really mean.

When it comes to data access, you've probably built up a working knowledge of SQL -- you can pretty much get SQL to do what you need. You've probably assembled a personal toolkit with some combination of writing raw SQL, a graphical tool for building SQL and ADO.NET. Your fingers can probably automatically type out the five or eight lines of code to create and open a connection, define a command object, call the ExecReader method and loop through the retrieved records.

And you know that you'll need to learn a bunch of new stuff to really use LINQ. During that period your productivity will be reduced, but your deadlines won't change. Finally, there are surely things you'll want to do in LINQ that, currently, your fingers won't type out automatically.

I'm here to help. It's time to give up ADO.NET and SQL and commit to the potent combination of LINQ and Entity Framework. Instead of writing all that ADO.NET code, line by painful line, you'll declare what you want with LINQ, and LINQ/Entity Framework will write the code for you.

The code that's generated by the LINQ/Entity Framework combination is, effectively, code written by the people who designed .NET and ADO.NET. I don't know if these people are smarter than me or you (though I have my suspicions), but they do know a great deal more about how those underlying technologies work. Trust me, you want their code.

Check out my Practical .NET column, Why You Really Should Be Using LINQ, for more on this compelling data access technology.

About the Author

Peter Vogel is a system architect and principal in PH&V Information Services. PH&V provides full-stack consulting from UX design through object modeling to database design. Peter tweets about his VSM columns with the hashtag #vogelarticles. His blog posts on user experience design can be found at http://blog.learningtree.com/tag/ui/.

comments powered by Disqus

Featured

  • Microsoft Revamps Fledgling AutoGen Framework for Agentic AI

    Only at v0.4, Microsoft's AutoGen framework for agentic AI -- the hottest new trend in AI development -- has already undergone a complete revamp, going to an asynchronous, event-driven architecture.

  • IDE Irony: Coding Errors Cause 'Critical' Vulnerability in Visual Studio

    In a larger-than-normal Patch Tuesday, Microsoft warned of a "critical" vulnerability in Visual Studio that should be fixed immediately if automatic patching isn't enabled, ironically caused by coding errors.

  • Building Blazor Applications

    A trio of Blazor experts will conduct a full-day workshop for devs to learn everything about the tech a a March developer conference in Las Vegas keynoted by Microsoft execs and featuring many Microsoft devs.

  • Gradient Boosting Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the gradient boosting regression technique, where the goal is to predict a single numeric value. Compared to existing library implementations of gradient boosting regression, a from-scratch implementation allows much easier customization and integration with other .NET systems.

  • Microsoft Execs to Tackle AI and Cloud in Dev Conference Keynotes

    AI unsurprisingly is all over keynotes that Microsoft execs will helm to kick off the Visual Studio Live! developer conference in Las Vegas, March 10-14, which the company described as "a must-attend event."

Subscribe on YouTube