2
What happens to a search that uses the include
of Entity Framework
on a property that can be null.
var ocorrencia = db.Ocorrencia
.Include("Pessoa")
.FirstOrDefault(c => c.id == 3);
That object ocorrencia
may own the property Pessoa
as null
.
To model
:
public partial class Ocorrencia
{
[Key]
public int id { get; set; }
public Pessoa Pessoa { get; set; }
public int PessoaId { get; set; }
}
public class Pessoa
{
[Key]
public int id { get; set; }
public string nome { get; set; }
}
The Occurrence object will be returned with the Null Person object, or nothing will be returned?