contains entity
types they will still be tracked by default
Example :
In the following query, which returns an anonymous type
, the
instances of Book
in the result set will be tracked
using (var context = new BookContext())
{
var book = context.Books.Select(b => new { Book = b, Authors = b.Authors.Count() });
}
If the result set does not
contain any entity
types, then no tracking
is performed
Example :
In the following query, which returns an anonymous type
with some of
the values from the entity (but no instances
of the actual entity
type), there is no tracking performed.
using (var context = new BookContext())
{
var book = context.Books.Select(b => new { Id = b.BookId, PublishedDate = b.Date });
}