5
I’m making a call in my Pository but CPF does not always exist in the BD. When it does not exist in the database I get the following error.
Repository
public VendedorModel GetById(int CPF)
    {
        using (var db = new PowerVendasEntities())
        {
            var registro = db.Vendedor.Single(x => x.VendedorCPF == CPF);
            return VendedorFactory.ToModel(registro);
        }
    }
How best to solve this problem ?

Possible duplicate of In the Entity Framework, the Singleordefault() and Firstordefault() methods present different behaviors?
– Jéf Bueno