Hi,
I am looking into the mapping of multiple Entities(Classes) onto one generic storage entity(Table). Theoretically this is all possible within ED, but I get an error about colliding IDs:
1 Problem in mapping fragments starting at line 426:EntitySets 'tClient1s' and 'Classes' are both mapped to table 'Classes'. Their primary keys may collide.
D:\Projects\MyProject\MyProject.Models\MyProject.edml
I can see the problem. The underlying table has its ID column set to INT32 and is an Identity column so autogenerates the PK.
Can I do this? How do I get around this error?
Thanks.
P.S I am currently mapping my Classes one to one with DB Views(Storage Objects) and this works fine. However I have just realised I should not need to set up DB Views as well since this is just another layer of mapping.
Can one map multiple classes to one storage entity ie table? Potential issue with Colliding IDs
Re: Can one map multiple classes to one storage entity ie table? Potential issue with Colliding IDs
Please take a look at the sample of table splitting which shows the way how to map two classes in CSDL to the same table in SSDL: http://www.devart.com/entitydeveloper/e ... eloper.chm > ORM Support > Entity Framework > Concepts > Working with Classes > Table Splitting.
Re: Can one map multiple classes to one storage entity ie table? Potential issue with Colliding IDs
Hi,
This still seems to only allow one use of a Storage Object Property. For example if I do setup up table splitting on a table called Class and pull "Name" and "Value" to another entity, then "Name" and "Value" are not longer available for use by another entity. I guess I need "Table Sharing" not "Table Splitting".
What I need to do is create a number of different entities that map to the same Storage object, and within each Entity I can map each specific Property to the underlying Storage Object Column like how one would use a Database View. One can setup 10 different Views onto one Table and each can update the base table. So like this I need to setup ten different entities that map onto one base Storage Object(Table). Perhaps it is not possible without PKs colliding???
Without the ability to do this, then I need to create DB Views each of which becomes a Storage Object which each supporting a seperate Entity.
Any more thoughts please?
Thanks.
This still seems to only allow one use of a Storage Object Property. For example if I do setup up table splitting on a table called Class and pull "Name" and "Value" to another entity, then "Name" and "Value" are not longer available for use by another entity. I guess I need "Table Sharing" not "Table Splitting".
What I need to do is create a number of different entities that map to the same Storage object, and within each Entity I can map each specific Property to the underlying Storage Object Column like how one would use a Database View. One can setup 10 different Views onto one Table and each can update the base table. So like this I need to setup ten different entities that map onto one base Storage Object(Table). Perhaps it is not possible without PKs colliding???
Without the ability to do this, then I need to create DB Views each of which becomes a Storage Object which each supporting a seperate Entity.
Any more thoughts please?
Thanks.
Re: Can one map multiple classes to one storage entity ie table? Potential issue with Colliding IDs
This is correct.EdB wrote:I need to create DB Views each of which becomes a Storage Object which each supporting a seperate Entity.