i want to implement a sales aand inventory management system, am confused as to how to apply dependency injection in the system. I want to have an inventory class that uses database to persist its data, should i have a class that handles the database connection say DBConnectionManager, then a database layer DBWrapper that uses DBConnectionManager and interacts with the DB, then acts as an abstract layer between the DB and classes that use the DB such as Inventory, Users, Customers, Sales. Or should i write sql codes in each User, Customer, .... Class.
Have youi tryed the Repository Pattern ?
It's great to use with DI, you build a root class that holds connections and basic operations like Update, remove etc...
And then extend that class to create more specific behaviours with more meaningful names...
Here is the a link about it
http://nhibernate.hibernatingrhinos.com/27/the-repository-pattern