[PR #298] [MERGED] Fixes Entity Framework (not core) LINQ errors #2107

Open
opened 2026-01-29 18:17:15 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/radzenhq/radzen-blazor/pull/298
Author: @emumanu
Created: 11/30/2021
Status: Merged
Merged: 12/1/2021
Merged by: @enchev

Base: masterHead: master


📝 Commits (1)

  • 12205bf Fixes Error: System.NotSupportedException: Unable to cast the type 'BlazorRadzenTests.Country' to type 'System.Object'. LINQ to Entities only supports casting EDM primitive or enumeration types.

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 Radzen.Blazor/DropDownBase.cs (+1 -1)

📄 Description

Fixes Error: System.NotSupportedException: Unable to cast the type 'BlazorRadzenTests.Country' to type 'System.Object'. LINQ to Entities only supports casting EDM primitive or enumeration types.

In order to fix the problem, we convert the IQueryable to IEnumerable, we perform the cast to IEnumerable

## 📋 Pull Request Information **Original PR:** https://github.com/radzenhq/radzen-blazor/pull/298 **Author:** [@emumanu](https://github.com/emumanu) **Created:** 11/30/2021 **Status:** ✅ Merged **Merged:** 12/1/2021 **Merged by:** [@enchev](https://github.com/enchev) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`12205bf`](https://github.com/radzenhq/radzen-blazor/commit/12205bf08b9f57ce39bb2f1e847c3f6675e2e4f9) Fixes Error: System.NotSupportedException: Unable to cast the type 'BlazorRadzenTests.Country' to type 'System.Object'. LINQ to Entities only supports casting EDM primitive or enumeration types. ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `Radzen.Blazor/DropDownBase.cs` (+1 -1) </details> ### 📄 Description Fixes Error: System.NotSupportedException: Unable to cast the type 'BlazorRadzenTests.Country' to type 'System.Object'. LINQ to Entities only supports casting EDM primitive or enumeration types. In order to fix the problem, we convert the IQueryable to IEnumerable, we perform the cast to IEnumerable<object> and then we call ToList() More info and test project here: https://forum.radzen.com/t/selecting-an-item-in-a-dropdowndatagrid-causes-exception/9131 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 18:17:15 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#2107