Inheritance as used in your project is about the 'entity' using the tables to create an inheritance structure...I love it and it works great.
What I would like to explore is 'record inheritance'. This is where you have one row (Row A) with a bunch of fields and you want to create a new row (Row B in the same table) that links itself back to Row A. All set, no problem.
Now, that 'relationship' above is not the typical parent/child relationship that the above normally represents. In this case when I retrieve Row B, I will look to see if it has a link to a parent (Row A) and if it does, most field values will come from Row A - but some of the field values (if defined in Row B) will come from Row B! This allows you to have 'inherited records' so that one change to a parent is reflective in all the children, etc.
I can do all the above with LLBLGen and such....not a problem. However, what is the best way to retrieve the records?
If I was doing a custom projection in the linq to a named or anonymous type, there are NO issues with this scenario at all.
var answer=from thetable in metaData.Table
join inheritTable in metaData.Table on thetable.TableIdInheritedFrom equals inheritTable.TableId into joinedTable
from inheritTable in joinedTable.DefaultIfEmpty()
select new{ description=inheritTable.Description ?? thetable.Description, ....}
However, may times I am selecting the LLBLGen entity as what is returned. Given that - is there a way to return the LLBLGen entity with modified fields?
var answer=from thetable in metaData.Table
join inheritTable in metaData.Table on thetable.TableIdInheritedFrom equals inheritTable.TableId into joinedTable
from inheritTable in joinedTable.DefaultIfEmpty()
select thetable {substitute inheritTable.Description here if possible?}
Not sure if I was clear in explaining this or if there is anything I can do to get this all done in one linq query. I could pull back both the inheritTable and theTable entity and go through and change them, etc....
Thoughts?