c# - Multiple requests with Include and Where condtition throws exception -
i using asp.net core ef core. if multiple requests same controller method of thoes requests throws: object reference not set instance of object
, without detailed explanation. if 1 request controller- no exception occur.
here reconstructed example of existing system
public class player { public int id { get; set; } public string name { get; set; } public team team { get; set; } } public class team { public int id { get; set; } public string name { get; set; } public list<player> players { get; set; } }
this code throws exception
public async task<list<player>> test() { using (repository.dataprovider.repodbcontext db = new repository.dataprovider.repodbcontext()) { return await db.players.include(x => x.team).where(x => x.team.id == 1).tolistasync(); } }
i did little research , realize exceptions occurs if there combination include
, where
statement using same property (team
in case). if remove include
or where
works fine.
is sort of bug or doing wrong?
edit: reproduce problem https://github.com/brivvirs/efcorebug
Comments
Post a Comment