Overview
Entity Framework
Simple Blazor Grid provides Entity Framework support as a separate package (see installation for instructions on getting started). The package provides Entity Framework specific implementations of searching and sorting that are either incompatible or not as performance as the core implementation however, all features that are provided by the core package (searching, sorting etc.) are all available to be used by Entity Framework.
Installation
The SimpleGridEntityFrameworkDataSource<T>
The SimpleGridEntityFrameworkDataSource<T>
powers the Simple Blazor Grid / Entity Framework integration. A new instance should be passed as the DataSource
to your SimpleGrid
component. It takes a single parameter of IQueryable<T>
which should be taken from your database context. The example below shows how this should be used, be sure to include any relevant .Include()
s where required.
<SimpleGrid TType="Order"
Title="Orders"
SimpleGridDataSource="@(new SimpleGridEntityFrameworkDataSource<Order>(Context.Orders.Include(x => x.Customer).AsQueryable()))">
</SimpleGrid>
Entity Framework Implementations
This section details the different implementations between the Core package and the Entity Framework package
Searching
When using the search box, the core package will call .Contains(query)
on the target property/properties to determine if the current object should be returned as part of the search query. The Entity Framework version of the search will instead call the EF.Functions.Like(property, pattern)
method. This avoid any client side execution are results in a much more performance query.