I need an advice. I have two class and one ofe them a derived class. I want to insert my base and derived class in a one method. How can i accomplish this?
//my entities
public class Form
{
public int FormId { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
public string Message { get; set; }
}
public class ReturnForm : Form
{
public int OrderId { get; set; }
}
//my repository
public class FormRepository : IFormRepository:IDisposable
{
private readonly MyContext _db;
public FormRepository(MyContext db)
{
_db = db;
}
//I want to insert here Form or ReturnForm objects.
//What can i do?
public void AddFormMessage(Form form)
{
_db.Forms.Add(form);
}
}
Aucun commentaire:
Enregistrer un commentaire