Is Entity Framework the Next ODBC?
What made ODBC a viable technology? It created a single interface for which drivers could be written allowing access to a data store. ODBC drivers were written for text files, Excel Documents, Microsoft Exchange, ISAM Files, Relational Databases, and much more. The key was, there was a common interface used by an ODBC consumer; the device drivers handled all the different techniques unique to the data store.
The key components of the interface were how to write statements to retrieve data, and how to return results to the consumer. Results were returned in Data Tables, Data Sets, or Data Readers.
So, what’s wrong with that? The issue is that Data Tables, Data Sets and Data Readers are not type specific, unless you use strongly typed data sets.
Jump forward in time to the current release of Entity Framework. Much like nHibernate, Entity Framework is an ORM Mapper, matching objects to a data storage mechanism. Today it connects easily to Relational data stores right out of the box. The difference is that Entity framework returns objects or collections of objects. Replace Data Tables and Data Readers with collections of objects or an object, and you have an interesting replacement that is completely type safe.
Moreover, you don’t have the overhead of a strongly typed dataset using Entity Framework. The relationships are already known as part of the framework resulting in code that is type safe, yet more flexible than a Data Set with multiple tables.
But what about non-relational data stores? I’m told you can implement your own persistence layers for Entity Framework by implementing the IEnumerable and IQueryable interfaces in your own code. That being the case, you should be able to emulate the same functionality as ODBC when it comes to reading and writing from/to anywhere. And, now you have a type safe capability working with Objects native to the consuming code.
This capability could really extend the Repository pattern. What do you think? Seems to easy? Brainstorms usually are too easy; it’s in the implementation when things get sticky. Drop me a note for a sanity check at btaylor@sswug.org.
Cheers,
Ben
$$SWYNK$$
Featured Article(s)
Recycle It! SharePoint’s First Line of Defense
While SharePoint 2010 continues the tradition of a two-stage recycle bin, it seems that there is still some confusion as to just how the recycle bin functions.
Featured White Paper(s)
Encryption & Key Management for Microsoft SQL Server 2008
Written by Townsend Security
Simplify encryption and key management on … (read more)
Featured Script
sp_MY_sqlmaint
This procedure runs sp_MY_sqlmaint_xxxx where xxxx is in (‘dbcc’, ‘rndx’, ‘stat’). It mimics xp_sqlmaint on filenames and de… (read more)