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
_dbContextProvider.GetDbContext().Database.Connection.ConnectionStringto verify that it is connecting to the same database server/instance you are inspecting for records. Also check that your context hasn't added alternate tables based on the naming convention. (I.e. under default namespace or pluralized class name).IgnoreQueryFilters(), probably you have defined query filters.