Software Development

.NET data technologies overview

Justin James provides an introduction to ADO.NET, LINQ, Entity Framework, NHibernate, WCF Data Services, WCF RIA Services, and ODBC in his back to basics .NET series.

For the second installment of my TechRepublic series that highlights various .NET technologies and explains what they are, I am focusing on .NET's data capabilities.

  • ActiveX Data Objects .NET (ADO.NET) is a collection of technologies that encompasses basic data connection functionality. Things like the ability to connect to a database are part of ADO.NET. Don't let the ActiveX in the title confuse you -- that's just some branding on Microsoft's part from ages ago to help ease developers' minds about the technology. ADO.NET is part of the .NET Framework.
  • Language Integrated Query (LINQ) was introduced in .NET 3.5; it provides a standardized set of SQL-like expressions to be used inline in other .NET languages such as C# and VB.NET. Objects may provide LINQ providers so they can be queried (including updates and deletions).

    It may not seem obvious at first, but using a SQL-like language to query data is very useful. LINQ is more than just about querying databases -- it can be tied to XML data, objects in memory, Web services, ORM systems, and more. As a result, having a standardized way to work with data regardless of the backing storage system allows you to build applications with much less learning and effort. Some common LINQ providers are:

    • LINQ-to-objects -- objects that implement IEnumerable.
    • LINQ-to-XML -- the XML objects in the LINQ namespace.
    • LINQ-to-Entities -- Entity Framework.
    • LINQ-to-NHibernate -- NHibernate.
    • LINQ-to-SQL -- SQL Server databases.
  • Entity Framework (aka "EF") is Microsoft's ORM built on top of ADO.NET technologies. Its initial release was widely panned as being feature poor and overly complex. The second release (confusingly called Entity Framework 4) contains a lot of improvements and addresses many of the concerns about the initial release. EF can be used through LINQ.
  • NHibernate is an open source ORM based on Hibernate for the Java platform. NHibernate has found favor within the .NET community for being a well-made product. LINQ can query NHibernate. NHibernate competes directly with Entity Framework and is well supported by the community.
  • Windows Communication Foundation (WCF) Data Services are built on top of the WCF platform. These services allow a simple Web service to be built to access an underlying data source, and can be automatically generated from a data source. If you need to expose data to an external client, WCF Data Services is your best bet. It allows for very granular and discrete permissions for the security minded. WCF produces XML, RDF, or JSON. WCF Data Services creates a RESTful Web service.
  • WCF RIA Services, another sub-set of the WCF platform, specializes in creating N-tiered applications with Silverlight. WCF RIA Services encompasses the server side and the client side. On the client side, it generates classes that are aware of CRUD operations (but not the underlying logic) on the server, so that operations on the client can easily trigger the appropriate logic on the server.
  • Open Database Connectivity (ODBC) is the granddaddy of all Windows data connectivity systems. While ODBC is not a .NET-specific technology, ADO.NET can connect to ODBC datasources.

What technology would you like to see in the next edition of this series, which will publish in about a month?

J.Ja

Additional TechRepublic resources

About

Justin James is the Lead Architect for Conigent.

10 comments
sukumarraju
sukumarraju

What technology would you like to see in the next edition of this series, which will publish in about a month? J.Ja Answering your query 'Can you elaborate WCF data services' please. Thanks, sukumarraju

sukumarraju
sukumarraju

Good article, thanks for elaborated information. Would like to know the advantage of using WCF Services, we have class library proejct(ORM) that consists of no. of methods, these methods are exposed through WCF services. By utilising WCF Services what are the additional pros over what we have(class library project with ORM file and classes(inherits ORM) with methods to interact with database)

barrynovak5
barrynovak5

Thanks for the post. It was very useful in helping to sort out the options. I understand you have a day job and probably couldn't take a deeper dive, but it would be nice to see a comparative analysis--i.e. under what conditions should you opt for one method over the others. For example, if you're working in an Oracle world, I gather that LINQ-to-SQL is not an option at this point.

jmuletalbiach
jmuletalbiach

Also for OWL / SKOS use on .NET environment U(closed and open world cases). As far as I know, not a lot available on .NET ( it is a pity but seems java frameworks and solutions are best positioned)

sabza
sabza

I am interested about NHibernate, a little more detail if possible please.

Justin James
Justin James

WCF Data Services is a quick way to get to the point that you are already at. If what you use is doing the same job and working fine, stick with it. The only reason to migrate to WCF DS is if the maintenance is very difficult and needs a lot of manpower and you are looking for something that uses more standard technology. J.Ja

Justin James
Justin James

... is really based on your end needs. For example, WCF Data Services is a good, general purpose way of getting data to a client through a firewall, but if you are working internally, NHibernate, Entity Framework, or LINQ-to-SQL are better choices. ODBC and ADO.NET are the goto choices for non-SQL Server backends in general, especially if you point ADO.NET to an ODBC source to get to a system that supports ODBC and not much else (nearly everything does). Hope this helps! There should be a LINQ provider for Oracle, by the way, it's just not there "out of the box". J.Ja

Justin James
Justin James

There's a good chance that I will be writing an NHibernate-specific article in the near future. Entity Framework has not interested me enough to motivate me to do it, but NHibernate does. J.Ja

sabza
sabza

That would be great, I would be watching the space.

Editor's Picks