I am migrating a legacy VisualFox system in .Net where the tables were made all out of relationship, in ADO, without foreign key in relationships. Only by comparing a string of the name "Type" to differentiate whether the record in a Table, eg Address belongs to Correspondent, Store or Customer.
The system is very large and there are several relationships similar to this for example: Store and Correspondent have a Contact table also listing the ID and differentiating it by the Type.
It is very difficult to mirror this rule in EF (this is possible, because I am a beginner and I am still learning). The table looks like this:
EnderecoId - ReferenceId - Tipo - Logradouro
1 - 1 - Loja - Rua tal tal tal
2 - 1 - Correspondente - Rua tal tal tal
3 - 1 - Correspondente - Rua tal tal tal
4 - 1 - Cliente - Rua tal tal tal
Can you make these rules using a Type string as a way to differentiate addresses? If it is not possible, would it be right to use Composite Key in this case?