I learned from the (still imperfect) Documentation, that in an MVVM Scenario one would use QueryableEntityCoreCollectionView to handle various CRUD Scenarios.
Constructing the QueryableEntityCoreCollectionView like so inevitably leads to a DB-Query fetching all rows, without any limitation.
var purchaseOrderContext = new PurchaseOrderContext();
PurchaseOrdersView = new QueryableEntityCoreCollectionView<PurchaseOrder>(purchaseOrderContext, purchaseOrderContext.PurchaseOrders, new Collection<string>());
Am I using it wrong?
The Context is of type Microsoft.EntityFrameworkCore.DbContext
Anyone?
Thx, Martin
4 Answers, 1 is accepted
Hello Martin,
Thank you for the shared code snippet.
I tested this scenario in a sample project by adding some logging in the Output window, however on my end only the currently displayed items are fetched from the database. I am attaching the sample project that I used for testing purposes for your reference. Note, that it uses the Northwind database, which you can generate with the following sql script.
Can you check out the shared project and see how it differs from the setup on your end? Should you need any further assistance, can you modify the sample project in order to demonstrate your scenario and send it back?
Additionally, can you share with which UI control you are using the QueryableEntityCoreCollectionView? For example, if it is with the RadGridView, can you make sure that its UI Virtualization is not disabled (a possible reason for that can be placing the control in a container that measures it with infinity)?
I remain at your disposal for any other questions you might have.
Regards,
Vladimir Stoyanov
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Hi Vladimir,
thanks for your reply.
I eliminated the view. There is a
select *
issued when constructing the
Data = new QueryableEntityCoreCollectionView(...)
With the view in place it is follwed by a another
select *
followed by
Select top(@p0) select count (*)
The view is:
<telerik:RadGridView Grid.Row="0"
ItemsSource="{Binding ElementName=DataPager, Path=PagedSource}"
GroupRenderMode="Flat"
IsReadOnly="True"
EnableRowVirtualization="True"
RowIndicatorVisibility="Collapsed"
CanUserFreezeColumns="False"
CanUserResizeColumns="False"/>
<telerik:RadDataPager Grid.Row="1"
Name="DataPager"
Source="{Binding Data}"
PageSize="10" />
Hello Corinne,
Thank you for the update. I was not able to replicate the "select *" queries in the sample project attached to my previous reply. I was only able to observe a "SELECT COUNT(*)" query, which is expected as the QueryableEntityCoreCollectionView needs to have the total item count.
May I ask you to modify the shared project in order to demonstrate the observed on your end behavior and send it back? This will hopefully allow me to investigate the scenario further and better assist you.
Thank you in advance for any help you can provide.

Hi Vladimir,
sorry for my late reply and thank you for your demo project.
Please habe a look at the attached .sln.
I am running against SQL-Serrver 2019.
Please observe the SELECT * without WHERE-clause beeing issued.
Why is this?
Regards Martin
Hello Martin,
Thank you for the shared project.
I was able to replicate the described scenario and I have logged it in our feedback portal: EntityFrameworkCoreDataSource: A query for all items was sent to the server upon initializing a QueryableEntityCoreCollectionView. As a small thank you for your involvement, I have added some telerik points to your account.
We have already introduced a potential fix and if it passes testing, you will be able to check it out in our next week's LIB. For the time being, you can follow the linked feedback item to receive updates about its status.
Of course, feel free to contact us again, if you have any other questions.
Regards,
Vladimir Stoyanov
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.