If you really insist on hiding the ORM layer behind your BO layer, then Dependency Injection should still be able to help you out. Note that you will not be able to get away from referencing the DI library from your UI thread though, because that'll be where your business objects will come from then.
Approach:
- Create an interface that contains methods to load the data to populate
User
objects
- Implement this interface in your ORM project
- At start-up, register the ORM implementation against the interface using a DI container of some sort (read up the details on whatever DI library you use, for example: www.ninject.org for something lightweight)
- Give the
User
object a constructor that takes an instance of the population interface to load data from
Then when you need a User
object, you ask the DI library to create it, and the DI library will construct the User
and give it a reference to the ORM implementation. You'll have to inject some properties into the DI call as well for the 'username' and 'password' to be able to fully populate it with values.
Note that this is not exactly what DI was invented for... application code is really supposed to deal with ORM directly to create/read/update/delete business objects.