You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I seem to have found an issue in the Linq provider.
Consider the following simple query
var contactsQuery_FullQueryInline = from contact in context.ContactSet
join account in context.AccountSet
on contact.ParentCustomerId.Id equals account.AccountId
where contact.ContactId == new Guid("d0269203-9b90-ec11-b400-000d3a224071")
select new
{
Contact = new Contact
{
ContactId = contact.ContactId,
FirstName = contact.FirstName,
MiddleName = contact.MiddleName,
LastName = contact.LastName,
BirthDate = contact.BirthDate,
},
Account = new Account
{
AccountId = account.AccountId,
Name = account.Name
}
};
var results_Orig = contactsQuery_FullQueryInline.FirstOrDefault();
This works just fine, as you'd expect. We get the details of our contact & some info on the joined account.
However, if we're selecting a load of properties (or if we have multiple queries looking for the same fields), you'd ideally want to split the selections out into their own selector functions.
Aiight, easy enough ...
var contactsQuery = from contact in context.ContactSet
join account in context.AccountSet
on contact.ParentCustomerId.Id equals account.AccountId
where contact.ContactId == new Guid("d0269203-9b90-ec11-b400-000d3a224071")
select new
{
Contact = SelectContactDetails(contact),
Account = SelectAccount(account)
};
var results = contactsQuery.FirstOrDefault();
private static Contact SelectContactDetails(Contact contact)
{
return new Contact
{
ContactId = contact.ContactId,
rkv_PortalGuid = contact.rkv_PortalGuid,
FirstName = contact.FirstName,
MiddleName = contact.MiddleName,
LastName = contact.LastName,
BirthDate = contact.BirthDate,
};
}
private static Account SelectAccount(Account account)
{
return new Account
{
AccountId = account.AccountId,
Name = account.Name
};
}
You'd expect that'd be the end of it. But the problem is that this only kinda works.
The contact details are selected as expected. The account properties however are included in the 'Attributes' list, but they're all 'NULL'.
CURRENT BEHAVIOR: Joined entity information is not selected by the DataVerse queryprovider.
EXPECTED BEHAVIOR: Joined entity details are selected by the DataVerse queryprovider.
The text was updated successfully, but these errors were encountered:
Dear chironh
Issue was discovered 'by accident' due to having multiple queries on the same CRM tables, that generally select the same things.
So, I ran some tests, with a simple account query (for the purpose of doing it on a default entity), via a project for which I was doing unit tests.
Passed a real instance of the IOrgService instead of a fake one & did some tests. As soon as I split off the object selector into its own method, things failed as described.
As such, it was always a 'new/fresh run' with just 1 retrieve action performed during that run for testing (and as you can see from the screenshots, in debug mode).
Thus, it shouldn't be a context tracking issue.
NOTE: Haven't tried it yet via passing the object selector as a lambda, which is also a common thing to do if you want to have a generic method but allow the caller to specify columns.
I'd assume it'd fail just the same.
From: chironh ***@***.***>
Sent: Tuesday, 11 July 2023 13:06
To: microsoft/PowerPlatform-DataverseServiceClient ***@***.***>
Cc: Kevin Van Puyvelde ***@***.***>; Author ***@***.***>
Subject: Re: [microsoft/PowerPlatform-DataverseServiceClient] Linq query -> JOIN -> Select -> All selected properties 'null' (Issue #382)
Just to be sure: you're not experiencing a tracking issue on the context object here?
(as in: that specific account is not queried before?)
I deleted my comment right after initial posting it because I re-read the original message and I saw missed an important part where the query succeeded without using methods.
I know I'm way behind on responding to this one, Sorry about that.
The LINQ provider is in somewhat of a limbo state right now. I had fowarded this over to them to investigate but they have declined it at the moment. What I would suggest you do here is provide this feedback on the doc link for the LINQ provider to help raise some visibility on this.
I seem to have found an issue in the Linq provider.
![image](https://private-user-images.githubusercontent.com/19588107/250586872-fc5115ca-4e32-4b47-b3c9-9d3d8641fe51.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkwNDIxMzksIm5iZiI6MTcxOTA0MTgzOSwicGF0aCI6Ii8xOTU4ODEwNy8yNTA1ODY4NzItZmM1MTE1Y2EtNGUzMi00YjQ3LWIzYzktOWQzZDg2NDFmZTUxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIyVDA3MzcxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE5Y2NhYjdlN2VkNjNkNjY3M2EyMDgxZTQyMWJmNjA5NWVjMWM2ZDZlMTRmNTAzODlmYmZiOWUwYjk5MmJkMjImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Vqn4pBQxqD7lJBmZvEvO4qZhLcAIbp1bnuEfw4H5_MM)
Consider the following simple query
This works just fine, as you'd expect. We get the details of our contact & some info on the joined account.
![image](https://private-user-images.githubusercontent.com/19588107/250587354-5617743f-0f17-4248-a55f-00719fd38668.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkwNDIxMzksIm5iZiI6MTcxOTA0MTgzOSwicGF0aCI6Ii8xOTU4ODEwNy8yNTA1ODczNTQtNTYxNzc0M2YtMGYxNy00MjQ4LWE1NWYtMDA3MTlmZDM4NjY4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIyVDA3MzcxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFiZWI0NzM5MzJjNzFhZjA0MTk2YmFiZDUwMTIxY2QzZmY2M2Y5YjliNTI4Y2ZhODA4NzA1ZDJjOTIzZmNlYjkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0._Ow4FxvBF6JtvqaGPdF5O2sGckr4PtgjFlsibAKQMuA)
However, if we're selecting a load of properties (or if we have multiple queries looking for the same fields), you'd ideally want to split the selections out into their own selector functions.
Aiight, easy enough ...
You'd expect that'd be the end of it. But the problem is that this only kinda works.
![image](https://private-user-images.githubusercontent.com/19588107/250587526-423e9a92-6d1b-4686-87f2-a140e2b509b3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkwNDIxMzksIm5iZiI6MTcxOTA0MTgzOSwicGF0aCI6Ii8xOTU4ODEwNy8yNTA1ODc1MjYtNDIzZTlhOTItNmQxYi00Njg2LTg3ZjItYTE0MGUyYjUwOWIzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIyVDA3MzcxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU0ZTZlM2YwYjFjYTQ1YjVjNzU2NzNiYzhiODZjY2E4OTcwNzE2MzMxNjgwMzQ0YWM1NDAxMTMyZjkxMjQ0MmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.4Gph_NmiYFOcU6U7dryTGgHhb1JD3-v10paR5nQwcbQ)
The contact details are selected as expected. The account properties however are included in the 'Attributes' list, but they're all 'NULL'.
CURRENT BEHAVIOR: Joined entity information is not selected by the DataVerse queryprovider.
EXPECTED BEHAVIOR: Joined entity details are selected by the DataVerse queryprovider.
The text was updated successfully, but these errors were encountered: