Multiple databases same structure, connection string injection

Jun 8, 2014 at 9:23 AM
Thanks for this project, it's great and I'm finding it really useful. I'm still fairly new to Unity and DI in general so it would be a massive help if someone could give me a couple of pointers as to the following:

I'm using Database first and I've modified the T4 templates so they output the required POCO classes for the main database. I now however have 5 (different tot the main) identical databases that I need to be able to use - these are instances of Sage where I need to mix 5 different companies' data. All the database schemas are identical so I should only need to generate a single set of classes - then just switch out the connection string to work with the required db.

My initial thought is that this should be fairly straightforward, I can add a constructor to the generated DataContext class, this would let me pass in a connection string - but I'm struggling as to how best to make this work in the context of this Framework.

Any pointers would be very much appreciated
Jul 3, 2014 at 5:48 PM
Marked as answer by lelong37 on 7/3/2014 at 9:48 AM