Entity Splitting: one class, two or more tables.
Here is how it is done in C#, but I need to get it working in vb.net.
One more thing: the class name and table columns do not match, so I have to be able to map that out, too.
I have to get this to work this way because the place I’m working at right now is a vb.net only shop and the database schema is fubar, but they have so much (millions) of lines of code done directly against the database in both asp classic, vb.net, AND asp.net webforms that changing the schema right now is not realistically possible.
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Post>()
.Map(m =>
{
m.Properties(p => new { p.Title, p.Content });
m.ToTable("Posts");
})
.Map(m =>
{
m.Properties(p => new { p.Photo });
m.ToTable("PostPhotos");
});
}
This is the VB equivalent of the above: