How to use nested funtionality with EF RRS feed

  • Question

  • Hi

    I am using EF 6 with code first which is generated from existing database. I need to do some big changes since we need to add features like revisions and hierarchy data for several models. How to do this without copy pasting just all the functionality between models?

    I think inheritance but since some of elements might have revisions some hierarchies and only few both -> multi inheritance will be needed... Also let's say thath I have minor functionality in base class (let say 3 columns) and I have inherited lot of bigger models -> since ef use TPH strategy by default its mean that all these huge models are now in the same table and what that will mean in terms of performance and other mess? (http://weblogs.asp.net/manavi/inheritance-mapping-strategies-with-entity-framework-code-first-ctp5-part-1-table-per-hierarchy-tph)

    Anyway I think that using as those functionalities as attributes will be more meaningfull in anycase. But if we choose strategy that every meaningfull part of model is in its own class they will be on difrent tables... And if I have datagrid with 7 columns with some meaning full information to user, it might be so that those are from 5 difrent table... which sounds pretty heavy again. And since we are talking about tight 1:1 pairings, separated table are just waste.

    After some searching I found complex type and I implemented it.... aaand noticed that its useless (since of course I need navigation properties to them).

    So I think that I need just some kind of dummy inline attributes, which are nested as classes in C# but dummy copypasted stuff in database table. Any hints?

    • Edited by Risord Tuesday, June 30, 2015 8:18 AM
    Tuesday, June 30, 2015 8:17 AM

All replies