Set the Configuration.ProxyCreationEnabled
field of your DbContext
to false
:
using (var dbContext = MyDbContext()) { dbContext.Configuration.ProxyCreationEnabled = false; return dbContext.MyProducts.AsNoTracking().Where(product => product.DepartmentId = departmentId); }
source share