One way to find a solution is to use inheritance.
[Table("map_ratings_vsh")] public class MapRatingsVSH : MapRatingsBase {} [Table("map_ratings_jump")] public class MapRatingsJump : MapRatingsBase {} public class MapRatingsBase { public string SteamID { get; set; } public string Map { get; set; } public int Rating { get; set; } [Column( "rated" )] public DateTime Time { get; set; } }
Then you can create your DbContext as follows:
public class StatsContext : DbContext { public DbSet<MapRatingsVSH> MapRatingsVSH { get; set; } public DbSet<MapRatingsJump> MapRatingsJump { get; set; } }
EF should not have any problems, understanding that these are two different tables, even if the implementation will be in one place ( MapRatingsBase
)
source share