views:

66

answers:

2

What are some of the common strategies used for data access?

Can LINQ be called a strategy?

+1  A: 

Strategy

Strategy, a word of military origin, refers to a plan of action designed to achieve a particular goal.

Now we have to identify the goal.

The goal could be the uniform access to the database from the application. If so, there can be several strategies.

  • Manual reading/writing data from the database. Options include inline SQL or using stored procedures.

  • Working with application-level objects which can save themselves to the database or materialize themselves from the database. You'd need a framework to do that. Such frameworks are known as ORMs. LINQ is one of them.

To summarize, LINQ can be considered a strategy for uniform access to the database on the high level using application-level entities without working with database-level objects.

P.S. Do you have a particular question or just seeking a philosophical discussion?

Developer Art
I am seeking a discussion.
abhi
+1  A: 

To further @Developer Art's answer; this might not be quite the question you asked, but you should abstract out data access from the application - don't "hard-code" your app to a particular data access implementation - this way you can swap out different data access implementations when you need to. This could be:

  • To access a different type of repository (DB, flatfile, service).
  • A different database platform (MS SQL, Oracle, MySQL, etc).
  • To migrate to a newer technology - say ADO.NET to Linq2SQL or EF4.
  • Or if you're providing something (probably open source) that others can write a data access provider for they'll be able to write their own implementation if they have specific needs.
Adrian K