I'm working with a large project (with a number of different cooks making the soup, across the years passing by) and just discovered the following code.
private IEnumerable<string> SomeSome()
{
using(DataModel context = DataModel())
{
context.SomeEntityName.AsNoTracking();
...
return context.SomeEntityName
.Where(entity => true)
.Select(entity => String.Empty);
}
}
Now, I've tripple-checked the AsNoTracking method and it's clearly said to return a queryable object that has no business with the EF's tracking facilities. A sort of "fire and forget" for ORM, so to speak.
Noting that:
- we don't store the value nor do anything with the contents of the returnee
- we obtain a new (and apparently trackable) set of objects to do stuff with
I want to remove the line. However, being modest (i.e. scared poo-lessly to damage the system), I'm cautious before deleting anything. Is there any implicit changes within the context of mine that might affect the second retrieval of the entities?
I haven't found any info on it - neither in favor of or against that theory. Also, I haven't found documentation for any other version of EF than 5.0 (as the link above shows) but we're using EF 6.1.3 and I understand that the method in question's been around in EF 4 as well.