views:

28

answers:

2

Last night I came up to sometihng intersting while designing my new project that brought me to ask this qustion here.

My project is supposed to follow Table Gateway pattern using tradional ADO.Net datasets for data access. I don't want to write plain queries in my data-access classes. So I came up with an idea of writing a parser kindaa api that exposes objects and methods to generate queries on the move based on my domain objects.

Later I want this api to hook up to my Business objects and provide Typed SQL generator api right on the business object instances.

Any idea or references how can I do this ? This seems very wide to start with that I'm compelled take your opinions here. Does there anything already exists that can do this ?

+3  A: 

You are describing an ORM (Object Relational Mapper). There are many of those around, nHibernate is probably one of the better known and used in the .NET circles.

There are many many different ORMs, and I would suggest you look at those before you start writing your own. If you really must, you can follow this set of blog posts by Davi Brion about building your own data layer, where he builds up a simple ORM.

Oded
A: 

You might want to take a look at the ADO.NET Entity Framework - this exposes your data as strongly typed business objects, and allows you to build queries using strongly typed expressions or Linq queries.

Mark_Carrington
m using tradional ado.net datasets. still EF gets me this working right out of the box but I need to do it all by myself.
this. __curious_geek