When I’m passing a
Func<EntityType,bool> sourceFunc = a => a.Name == "name";
to:
var crmEntities = m_xrmServiceContext.CreateQuery<EntityType>().Where(sourceFunc);
and then call
int i = crmEntities.ToList().Count;
it puts all the entities of EntityType in xrmServiceContext attached entities which is 488 entities!
But if instead of Func<> I use the original lambda expression, like so:
var crmEntities = m_xrmServiceContext.CreateQuery<EntityType>().Where(a => a.Name = "name");
and then call
int i = crmEntities.ToList().Count;
it will return only 1 entity in the attached entities.
I want to use the Func<> but I dont think that I want to have all those entities in the attached entities in xrm service context. Any idea why it puts them all there?
Intresting..The solution was to pass
Instead of
And it returned only 1 entity to attached entities 🙂