I'm fairly new in Entity Framework and web API. I'm trying to GET
data from a table. But the table is going to be selected from different databases. So, there's multiple databases with the same tables and I need to select which database (I'm thinking [Fromuri]
) I need to get the tables from. Right now I only have one database connected. Not sure if I need to add it all as a connection string or is there an easier way.
public IHttpActionResult Get()
{
using (var MGC = new GC_BranchNameEntities())
{
var serializer = new JsonSerializer();
var jsonIDSA = JsonConvert.SerializeObject(MGC.INV_LIVE_IDSA, Formatting.None);
try
{
return Ok(jsonIDSA);
}
catch (Exception e)
{
return BadRequest("Error occured when retreiving IDSA data " + e.Message);
}
}
}
Can I do something like using(var MGC = new SelectdatabaseEntitiesusingParam)
something like that?