A customers ERP solution has (imho) a really ugly database structure. It doesn’t use expressive names for neither tables nor columns. The table for Addresses for example looks like this:
C001_T001
=========
T001_ID
T001_F001
T001_F002
T001_F003
[...]
- T001_ID is the primary key
- T001_F001 stores the title
- T001_F002 stores the last name
- T001_F003 stores the fist name
- T001_F003 stores the email address
- … you get the point
The database exposes an OData-Feed, which I can use to perform database operations.
My idea is, to create a kind of wrapper around it. So that querying the database is a bit more expressive, fun and eventually more productive.
// Not cool
ctx.C001_T001s.Where(x => x.T001_F002 == "Smith" && x.T001_F003 == "John")
// Cool!
Addresses.Where(x => x.LastName == "Smith" && x.FirstName == "John")
What are possible approaches to achieve this?
SImlpe. I do that all the time.
At least BlToolkit (my ORM on this place) is smart enough to push the where clause into the SQL statement, so I get efficient lookup and nice projections.