Cannot implicitly convert type IEnumerable to IQueryable

前端 未结 5 2056
一个人的身影
一个人的身影 2021-02-05 07:46

Obfuscated Scenario: A person has zero, one or many pets.

Using Linq to Sql, the need is to get an IQueryable list of pets for the given pe

5条回答
  •  情深已故
    2021-02-05 08:08

    what worked for me,

        var db = new DataClasses1DataContext();
    var personPets = from p in db.Persons
                     where p.PersonId == 1
                     select p.Pet;
    IQuerable pets = (IQuerable)personPets;
    

    strangely enough

提交回复
热议问题