現在、異なる接続文字列を使用する2つのdbcontextクラスが設定されています。 「Cedulados」テーブルから選択しようとするたびに、何らかの理由で「DefaultConnection」文字列を使用して巻き上げられます。私は間違って何をしていますか?MVCデータコンテキスト内の2つの異なる接続文字列
public class DataContext : DbContext
{
public DataContext()
: base("DefaultConnection")
{
}
public DbSet<SEG_CEmpleados> Empleados { get; set; }
public DbSet<SEG_CEmpNuevo> EmpleadosNuevos { get; set; }
public DbSet<SEG_Estados> Estados { get; set; }
public DbSet<SEG_Tarjetas> Tarjetas { get; set; }
public DbSet<SEG_Visitantes> Visitantes { get; set; }
public DbSet<SEG_Tipos> Tipos { get; set; }
public DbSet<SEG_TiposDoc> TiposDoc { get; set; }
public DbSet<SEG_Departamentos> Departamentos { get; set; }
internal void Refresh(RefreshMode clientWins, object articles)
{
throw new NotImplementedException();
}
}
public class CeduladosContext : DbContext
{
public CeduladosContext()
: base("Cedulados")
{
}
public DbSet<Cedulados20110712> Cedulados { get; set; }
internal void Refresh(RefreshMode clientWins, object articles)
{
throw new NotImplementedException();
}
}
public JsonResult PerCedula(string id)
{
string mun = id.Substring(0, 3);
string seq = id.Substring(3, 7);
string ver = id.Substring(10, 1);
var context = new CeduladosContext();
var ced = context.Cedulados.FirstOrDefault();
return Json(ced, JsonRequestBehavior.AllowGet);
}