I'm using Entity Framework 6 Code First to store a large POCO model in a database. The model happens to have 1000s of properties (don't ask lol**), meaning it must be split into multiple SQL tables (the column limit is 1024). I know this is normally done by specifying the individual columns like so:
modelBuilder.Entity<HugeEntity>.Map(m =>
{
m.Properties(e => new { e.Prop1, e.Prop2 });
m.ToTable("HugeEntity1");
}.Map(m =>
{
m.Properties(e => new { e.Prop3, e.Prop4 });
m.ToTable("HugeEntity2");
};
I'm wondering if there's any way to do this without having to specify the properties individually. Ideally it could partition an entity automatically based on a given column limit (viz. 1000).
Even if there is no standard way, what is the easiest hack to get this to work? The properties on the model are subject to change, so I would really like to avoid listing them exhaustively in more than one place.
Any advice appreciated!
**CONTEXT: This is a domain model, representing user entered data that should be captured on a certain web page. It is also exposed in a WebAPI. My team considered a key/value pair approach, but decided this would make the data more difficult to consume by future BI applications that hit the WebAPI.