I am creating an application for multiple clients, whereby there are both similarities and differences between the implementations for each client. I am using a mix of Win Forms and WPF for the UI and Entity Framework for the ORM. What I need is the ability to reuse shared components wherever possible.
One of the key issues is that the database for one client is oracle and the other is MS Sql, now I have got both working but only by changing elements at compile time. This means I have to have two sets of near identical projects, with just slightly different data projects. If a bug is found in one UI I have to open the other solution and edit it there also.
I have used Ninject on previous projects and though it might be possible to somehow invert the control of the Data project, injecting the specific project/classes into the UI, rather than the UI calling them directly.
The issue that I can’t seem to figure out is how to inject an entire project. I want to be able to say in the UI db.Customers.ToList(); and have it return the customers from whichever data project I have injected. The database models for both clients are the same at this point, though they might change in the future.
I’m sure there must be a pattern that would allow me to use these resources in a shared capacity.
Thanks
At what point can you make the decision about which type of connection you need?
This might be terribly naive, but couldn’t you just use an app setting to fire up the appropriate type of connection factory or repository at runtime? The simplest version of which:
Would this work? Or have I missed the point entirely?