Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

LINQ much slower then Retrieve when selecting/retrieving virtual entity lookups

Posted on by 307


hello,
in our Organisation we have several virtual entity lookups linked on our Incident entity.
When we query it by id with LINQ, it is much slower than with Retrieve from SDK (in average 2100m vs 500ms). It is even slower when querying only incidents where these lookups are not null.
When only non virtual fields are selected,  than it is equally quick with all methods.

Has anyone had  such experience?
Can somebody measure it on his System on some entity with wirtual field  lookups?
It looks to me like LINQ Assemblies/drivers are not working well with such lookups.
Here ist the code:
-------- LINQ -----
 I

context.IncidentSet.Where(x => x.IncidentId == incidentId).Select(x => new Incident
            {
                IncidentId = x.IncidentId,
                CustomerId = x.CustomerId,
                TicketNumber = x.TicketNumber,
                MyVirtualFieldLookup1 = x.MyVirtualFieldLookup1,
                MyVirtualFieldLookup2 = x.MyVirtualFieldLookup2,
                MyVirtualFieldLookup3 = x.MyVirtualFieldLookup3
            }).FirstOrDefault();

-------- Retrieve -----
var columnSet = new ColumnSet(
                Incident.LogicalNames.IncidentId
                , Incident.LogicalNames.CustomerId
                , Incident.LogicalNames.TicketNumber
                , Incident.LogicalNames.MyVirtualFieldLookup1
                , Incident.LogicalNames.MyVirtualFieldLookup2
                , Incident.LogicalNames.MyVirtualFieldLookup3);
service.Retrieve(Incident.EntityLogicalName,  incidentId, columnSet).ToEntity<Incident>();

  • Nikica Profile Picture
    Nikica 307 on at
    LINQ much slower then Retrieve when selecting/retrieving virtual entity lookups
    Anybody can help?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans