3
Basically I’m in doubt about when I should use 1:1 relationship or a large table.
In my case I would have the object
public class Person(){
public Guid Id {get;set;}
public string Name {get;set;}
public string Cnpj {get;set;}
public PersonAdress Adress {get;set;}
}
and then I would have the object
public class PersonAdress (){
public Guid PersonAdressId {get;set;}
public stirng Enderedo {get;set;}
public virtual Person Person {get;set;}
}
This is really good practice?
Or would it be better if I had a single entity
public class Person(){
public Guid Id {get;set;}
public string Name {get;set;}
public string Cnpj {get;set;}
public string Endereço {get;set;}
}
Of course I made a short version of more objects, they would have more fields and more 1:1 relationships.
I did some performance tests on SQLServer
and there was a very small difference in a universe of 20,000 records.
But as I know DBA, get overcast.
Yes, it is good practice to separate entities, and your example is right from the point of view of how to relate
– Ricardo Pontual
@Ricardopontual thank you very much!
– Rodrigo K.B
Yes! That’s good practice, yes. Even, imagine, people move. If you want to keep a history, this way it becomes easier to change further down ne...
– DiegoSantos