I've got a program with connections to 4 databases. In three of these databases the entity objects are very similar. Now my question is quite simple but I can't wrap my head around how to proceed.
I have three databases let's call them 1 2 and 3 in those I got Several Tables a b and c
I'm asking since 1a and 2a and 3a is almost the same is there a way for me to do something like this. ?
Using(interfaceDB DB = new DB1())
{
var getTabelA = (from a in DB.a select a);
}
Using(interface DB = new DB2())
{
var getTabe2A = (from a in DB.a select a);
}
Using(interface DB = new DB3())
{
var getTabe3A = (from a in DB.a select a);
}
foreach(interfaceDBTableA in getTabelA)
{
//do something here
}
foreach(interfaceDBTableA in getTabe2A )
{
//do something here
}
foreach(interfaceDBTableA in getTabe3A )
{
//do something here
}
Basically my hope is that I could then just put the loop part in to it's own method and reuse it without the need to customize it to the individual table ?