2 Corrections: LINQ *Can* Use POCO/SQL, and VB.NET *Doesn't* Suck

by Jon Davis 8. January 2009 21:17

Just a couple observations here.

1. LINQ *can* work with POCO/SQL.

A few (two or three?) posts ago, I complained that LINQ-to-SQL doesn't really "speak" SQL / ADO.NET, you're forced to use generated classes and a designer to work with the provider. Thus, if you want to avoid the designer and generated classes, you're forced to using plain old ADO.NET.

I am VERY happy to say that I need to go do more homework. LINQ-to-SQL does have POCO support, and in fact when reading this blog entry I realized that a week's worth of work on my pet project is garbage because it is exactly to detail what this blog seems to show that LINQ already designed it.


Why does this matter? Because I believe that a business object should be database / provider / ORM agnostic. It should NEVER implement database code within itself, and it shouldn't even inherit an ORM library object. I would be willing to tack on attributes/markers that don't do anything except provide mapping cues for an external ORM.

But even attributes can be avoided, and in the above-linked article's case, avoiding them is suggested. (I don't agree with that, though, because some members are database-bound, sometimes they are not, sometimes they are named differently from the database table columns, etc.)  

2. VB.NET Actually Doesn't Suck

While I think the syntax of VB.NET is painful to look at, to say nothing of writing, I must say that I greatly admire the features that set it apart from C#. Before v2008 I didn't think they were enough. ("My"?! Come on! Even the Windows Vista team was smart enough to eliminate "My" verbiage from Windows. You're going the wrong way!)

But at a .NET users group meeting I attended a couple months ago, I noticed the profound value of v2008's integrated XML support. I'm not talking about just Dim xx = <myxml>..</myxml>. That in itself is incredibly impressive, no doubt. But what impresses me more is how you can bury such XML expressions in LINQ statements. Add on top of that the ASP-style templating that is supported with it; you can do this: Dim xx = <myxml><%=myXmlValue%></myxml> And even this: 

Dim xx = <myxml>
<% For Each x In y %>
<% Next %>

I haven't validated that but that's what I understand it to offer. That demonstration doesn't say much until you see it in action... 

The blog link I mentioned above (under #1) has at the bottom of it a "crosspost" link, the recent article of which reminded me of this VB.NET functionality and made me realize that this really is something worth blogging about. And if I have to work with VB.NET in the future, so long as it is with .NET 3.5 / Visual Studio 2008, I shouldn't pass it up anymore. 

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Software Development | VB.NET


Add comment

(Will show your Gravatar icon)  

  Country flag

  • Comment
  • Preview


Powered by BlogEngine.NET
Theme by Mads Kristensen

About the author

Jon Davis (aka "stimpy77") has been a programmer, developer, and consultant for web and Windows software solutions professionally since 1997, with experience ranging from OS and hardware support to DHTML programming to IIS/ASP web apps to Java network programming to Visual Basic applications to C# desktop apps.
Software in all forms is also his sole hobby, whether playing PC games or tinkering with programming them. "I was playing Defender on the Commodore 64," he reminisces, "when I decided at the age of 12 or so that I want to be a computer programmer when I grow up."

Jon was previously employed as a senior .NET developer at a very well-known Internet services company whom you're more likely than not to have directly done business with. However, this blog and all of jondavis.net have no affiliation with, and are not representative of, his former employer in any way.

Contact Me 

Tag cloud


<<  May 2021  >>

View posts in large calendar