2
I’m starting to study LINQ to try to implement a project I’m working on. For examples both in articles as in videos, LINQ has an interface in visual Studio that generates the entity classes from the tables in the database. However, in my application project there are some particularities.
1) My entity classes are already created, so I want to be able to use them with LINQ.
2) The modeling of my database works as follows. I have a table called Clientes
which is what I call "daughter table" from another table called Pessoas
. Explaining, the table Pessoas
plays the role of a parent table, which stores part of the data from other tables such as Clientes
, Funcionarios
, etc. That is, fields that are in common in these tables like (Name, Email, Phone, etc.) are all stored in the main table Pessoas
. Following the concept of OOP heritage.
In the class modeling I did, Pessoa
is an abstract class, that is, it cannot exist alone, it is only to serve as a base class for concrete classes Cliente
and Funcionario
. So when a Cliente
part of the data must be stored in the table Pessoas
and the other part in the table of Clientes
How will LINQ handle this? Because if I were to generate the classes from the tables, LINQ would create a concrete class for the table Pessoas
but in my UML modeling Pessoa
is an abstract class.
Linq does not create the domain. Who does this is the Entity Framework. Your question will contemplate the Entity Framework?
– Leonel Sanches da Silva
http://www.youtube.com/watch?v=JeY6B0Yk5zE&t=17m06s
– Matheus Saraiva
I don’t think this approach creates heritage. Entity Framework has a more sophisticated device to deal with it. Would you like to know how it works? Or would you like an answer using this same approach?
– Leonel Sanches da Silva
Yes, other alternatives are welcome
– Matheus Saraiva
How the initial question is based on
LINQ
leave here a article which answers part of the question.– Matheus Saraiva