Basically I followed all the steps as I understand how you can see this is the DBContext that I have created.
namespace MODELO
{
using System;
using System.Data.Entity;
using System.Linq;
public class Ouroboros : DbContext
{
public static Ouroboros instancia;
public static Ouroboros OBTENER_INSTANCIA()
{
if (instancia == null)
{
instancia = new Ouroboros();
}
return instancia;
}
public Ouroboros()
: base("name=Ouroboros")
{
}
public virtual DbSet<Check_lists_PVR> Check_Lists_PVR { get; set; }
}
These are the object properties in question that I'm trying to save.
namespace MODELO
{
[Table("Check_lists_PVR")]
public class Check_lists_PVR
{
[Key]
public Int64 NroCL { get; set; }
public DateTime? Fecha { get; set; }
public string Turno { get; set; }
public string PVR { get; set; }
public string Operador { get; set; }
public string Item { get; set; }
public string Estado { get; set; }
public string Observacion { get; set; }
}
}
And finally all the functions that you program in "controller" to add, modify, delete, etc.
namespace CONTROLADORA
{
public class CHECK_LISTS_PVR
{
public static CHECK_LISTS_PVR instancia;
public static CHECK_LISTS_PVR OBTENER_INSTANCIA()
{
if (instancia == null)
{
instancia = new CHECK_LISTS_PVR();
}
return instancia;
}
MODELO.Ouroboros oOuroboros;
public CHECK_LISTS_PVR()
{
oOuroboros = MODELO.Ouroboros.OBTENER_INSTANCIA();
}
public void Agregar_CHKlist(MODELO.Check_lists_PVR oCHKPVR)
{
oOuroboros.Check_Lists_PVR.Add(oCHKPVR);
oOuroboros.SaveChanges();
}
public void Modificar(MODELO.Check_lists_PVR oCHKPVR)
{
oOuroboros.Entry(oCHKPVR).State = System.Data.Entity.EntityState.Modified;
oOuroboros.SaveChanges();
}
public void Eliminar(MODELO.Check_lists_PVR oCHKPVR)
{
oOuroboros.Check_Lists_PVR.Remove(oCHKPVR);
oOuroboros.SaveChanges();
}
public List<MODELO.Check_lists_PVR> Listar_CHKlists()
{
return oOuroboros.Check_Lists_PVR.ToList();
}
}
}
After much coming and going enable all migrations, update the database, start the program, charge the data and when I give to save the program does not break or throw errors, follow the processes as normal. but at the time of going to check in sql management that everything is correct the database does not exist. Someone who has gone through the same thing that can give me a hand?