This code works but I've heard from somewhere that when we use Select it pushes to execute Join operation. So will it considered a slow operation, or by the way is there a way/ program to check linq queries correctness, performance ...
public IQueryable<Entity> GetById(int id){return_context.Set<Entity().Where(p => p.Id == id);}
var actor = _repository.GetById(id)
.Select(a => new
{
a.Id,
a.FirstName,
a.LastName,
a.Bio,
a.Birthday,
a.Height,
a.Image,
Country = new
{
a.Country.Id,
a.Country.Name
},
Movies = a.ActorMovies
.Select(am => new
{
am.Movie.Title,
am.Movie.Year,
am.Movie.Image
})
}).FirstOrDefault();