I am using dapper extension methods like insert for everything related to the database in a project but I am not able to connect the models to each other. There are 4 tables in the database: category, event, speaker, and eventspeaker (pivot table). Is there a way to do it like using classmappings in NHibernate? Or do I have to change all foreign keys to int and do everything in the Save, update, etc.. methods?
public class Event
{
public int Id {get; set;}
public Category Category {get;set;}
public string Location {get;set;}
public DateTime Time {get;set;}
public void Save(){ /*TODO*/}
}
public class Category
{
public int Id {get; set;}
public string Category {get;set;}
public void Save(){ /*TODO*/}
}
public class Speaker
{
public int Id {get; set;}
public string Name {get;set;}
public void Save(){ /*TODO*/}
}
public class EventSpeaker
{
public Event event {get; set;}
public Speaker Speaker {get;set;}
}