I'm starting to study LINQ to try to implement a project I'm working on. For examples 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 peculiarities.
1) My entity classes are already created, so I want to be able to use them with LINQ.
2) Modeling my bank works as follows. I have a table named Clientes
which is what I call "daughter table" from another table named Pessoas
. Explaining, the Pessoas
table plays the role of a parent table, which stores some of the data from other tables as Clientes
, Funcionarios
, and so on. That is, fields that are common in these tables as (Name, Email, Phone, etc.) are all stored in the main table Pessoas
. Following the concept of heritage of the OOP.
In class modeling I have done, Pessoa
is an abstract class, that is, it can not exist by itself, it is just to serve as the base class for the concrete classes Cliente
and Funcionario
. So, when a Cliente
is inserted into the database part of the data must be written to the Pessoas
table and the other part to the Clientes
How will LINQ handle this? For if I were to generate the classes from the tables, LINQ would create a concrete class for the Pessoas
table but in my UML modeling Pessoa
is an abstract class.