Search code examples
entity-frameworklinqasp.net-coreentity-framework-coreaspnetzero

Not getting values from linq query in aspnetzero framework


I am executing following query. I am doing this in aspnetzero framework and doing this in UserAppService.cs file.

var rt = _dbContextProvider.GetDbContext().Users
                    .Where(e => e.Id == 11)
                    .FirstOrDefault();

But this is always returning null, in database there is record with Id = 11.

So anyone has any idea what is wrong in this.

Thanks


Solution

  • As Svyatoslav Danyliv said in the comment, the issue is related to the query filters, try to add the .IgnoreQueryFilters() to ignore the query filters.