DAL design question.

DAL design question.

I have a local SQLite database for local caching. The real database sits behind a REST interface. I'll have a separate synchronization mechanism to take care of the communication between REST and SQLite.

My app needs access to SQLite of course and I'm thinking about a lightweight DAL. Probably one class per table and maybe some higher level classes for groups of tables which are mostly used together via joins.

Would you:
1. Make the DAL a singleton which spits out a record for each table row.

2. Make the singleton spit out objects instead of records

3. Instantiate an object every time I need data. The objects would hold the data in fields and implement the actual loading/searching/joining as well.

Since I'm designing both the app and the database I have a quite strong connection between domain and database regarding the structure. I think I'd be most comfortable with keeping the same data structure all the way from the database to the domain objects (roughly). The local DB actually mimics the server db quite much as well.

Is this bad thinking? Should I pretend that I'm completely unaware of the db structure when working with the DAL?

Comments