Hey,

I'm just starting out in C# and getting to grips with OOD.

What are people's thoughts on the location of database access code in a C# program?

Off the top of my head, I see main 3 options:

1. DB code in its own class.
The main program has access to the other objects and also the DB class and acts as the go-between, keeping the objects themselves free of DB code.

2. Classes have DB code inside
Each object can perform its own DB activities and effectively manage itself but the classes then become less reusable.

3. DB Wrappers
Each class that needs DB access has a corresponding wrapper class that extends it and can do DB stuff.


I'm interested in opinions on which ties in nicest with good OO principles, and if anyone has any other suggestions?