0
In the project I am working I have the following doubts:
First, I made some inheritance tables in the database where each has only one column id(which is pk and fk of the table to which they inherit), and when generating the model(edmx) from the database the tables that have only one column are not created, Is there any settings where I can configure this? I’ve searched and found nothing related.
Secondly I would like to know if when the model is generated there is also some configuration where I can choose the tables that will be inherited to be generated with the correct configuration, because otherwise every time I have to make the inheritance in hand. What makes the process costly.
Note: Use of EF6.
Example of the similar model I’m using:
Type approval (Entity): id, situation, category, telephone, addresses
Homologation_course(Entity with Inheritance): id (is Primary key and foreing key referencing the homologation entity) id_curso(fk of the organisation)
Qualification (Entity with Inheritance): id (is Primary key and foreing key referencing the homologation entity)
1st Problem: When generating edmx the only generated entities are homologation and homologation. As the homologating entity does not need other data than the id it is not generated.
Put your database template!
– novic
I hope it’s clearer now.
– Guilherme Caixeta
If you are creating a database from scratch, it would be better if you use EF Code First, it is very easy. I can post an answer with an example of what a model would look like if you want.
– Rodrigo K.B
William what classes were created?
– novic
@Rodrigok. B unfortunately in the project that I am was deified to use edmx for entity generation in .Net. I also preferred to use EF6 Code First, but unfortunately I am stuck to this :(.
– Guilherme Caixeta
@Virgilionovic in the case it creates only the entity Person, if the personal and personal entities contain only the attribute id. But if I add any more attributes to them, the edmx generates them without problem.
– Guilherme Caixeta
So I don’t understand the problem!
– novic
@Virgilionovic so as I showed this model is an example, but I have entities that will inherit and have no attribute beyond the ID, and when the edmx Gero it does not recognize these entities.
– Guilherme Caixeta
So your model William has problems, because creating a table with a field that references another table does not have the need to exist. Always in that case there should be other fields!
– novic
I had also thought about it, but as in this case the inheritance was the best solution. But some entities that inherit from this entity have only the id field, so I avoid filling the parent entity with Foreign Keys. I’ll update the template to what I use to make things clearer.
– Guilherme Caixeta
How is it here [homologation_capacitadora(Entity with Inheritance): id (is Primary key and foreing key referencing the entity homologation)] YOU HAVE A TABLE WITH THE FIELD ID THAT IS PK AND FK ?
– Marco Souza
That’s right, this field is used to accomplish entity inheritance when the edmx diagram is generated.
– Guilherme Caixeta