Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CS/BindGridToLargeData/BindGridToLargeData.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DevExpress.Blazor" Version="24.1.8-pre-24340" />
<PackageReference Include="DevExpress.Blazor" Version="24.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.*-*" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />
Expand Down
3 changes: 1 addition & 2 deletions CS/BindGridToLargeData/Components/Layout/NavMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<DxMenu Orientation="@Orientation.Vertical" CssClass="menu">
<Items>
<DxMenuItem NavigateUrl="/" Text="Home" CssClass="menu-item" IconCssClass="icon home-icon"></DxMenuItem>
<DxMenuItem NavigateUrl="/weather" Text="Weather" CssClass="menu-item" IconCssClass="icon weather-icon"></DxMenuItem>
</Items>
</DxMenu>
</div>
</div>
9 changes: 6 additions & 3 deletions CS/BindGridToLargeData/Components/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
@rendermode InteractiveServer

<div>
<DxGrid Data="GridDataSource" VirtualScrollingEnabled="true" TextWrapEnabled="false" CssClass="my-grid">
<DxGrid Data="GridDataSource"
TextWrapEnabled="false"
VirtualScrollingEnabled="true"
FilterMenuButtonDisplayMode="GridFilterMenuButtonDisplayMode.Always"
CssClass="my-grid">
<Columns>
<DxGridDataColumn FieldName="ShipName" />
<DxGridDataColumn FieldName="ShipCity" />
<DxGridDataColumn FieldName="ShipCountry" />
<DxGridDataColumn FieldName="Freight" />
<DxGridDataColumn FieldName="OrderDate" />
<DxGridDataColumn FieldName="ShippedDate" />
</Columns>
Expand All @@ -31,4 +34,4 @@
public void Dispose() {
Northwind?.Dispose();
}
}
}
35 changes: 0 additions & 35 deletions CS/BindGridToLargeData/Components/Pages/Weather.razor

This file was deleted.

2 changes: 0 additions & 2 deletions CS/BindGridToLargeData/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using BindGridToLargeData.Components;
using BindGridToLargeData.Models;
using BindGridToLargeData.Services;
using Microsoft.EntityFrameworkCore;

var builder = WebApplication.CreateBuilder(args);
Expand All @@ -19,7 +18,6 @@
var dbPath = Path.Combine(env.ContentRootPath, "Northwind.db");
options.UseSqlite("Data Source=" + dbPath);
});
builder.Services.AddSingleton<WeatherForecastService>();
builder.Services.AddMvc();

var app = builder.Build();
Expand Down
11 changes: 0 additions & 11 deletions CS/BindGridToLargeData/Services/WeatherForecast.cs

This file was deleted.

17 changes: 0 additions & 17 deletions CS/BindGridToLargeData/Services/WeatherForecastService.cs

This file was deleted.

34 changes: 20 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,40 @@
<!-- default badges list -->
![](https://img.shields.io/endpoint?url=https://codecentral.devexpress.com/api/v1/VersionRange/902698768/24.1.3%2B)
[![](https://img.shields.io/badge/Open_in_DevExpress_Support_Center-FF7200?style=flat-square&logo=DevExpress&logoColor=white)](https://supportcenter.devexpress.com/ticket/details/T1268112)
[![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183)
[![](https://img.shields.io/badge/💬_Leave_Feedback-feecdd?style=flat-square)](#does-this-example-address-your-development-requirementsobjectives)
<!-- default badges end -->
# Product/Platform - Task
# Grid for Blazor - How to bind the component to a DevExtreme data source with Entity Framework Core

This is the repository template for creating new examples. Describe the solved task here.
This example uses [Entity Framework Core](https://learn.microsoft.com/en-us/ef/core/) data access technology to bind the [DevExpress Blazor Grid](https://docs.devexpress.com/Blazor/403143/components/grid) component to a [GridDevExtremeDataSource<T>](https://docs.devexpress.com/Blazor/DevExpress.Blazor.GridDevExtremeDataSource-1).

Put a screenshot that illustrates the result here.
![Bind the Grid to a DevExtreme Data Source](bind-to-devextreme-data-source.png)

Then, add implementation details (steps, code snippets, and other technical information in a free form), or add a link to an existing document with implementation details.
You can use the [GridDevExtremeDataSource<T>](https://docs.devexpress.com/Blazor/DevExpress.Blazor.GridDevExtremeDataSource-1) class to bind the DevExpress Blazor Grid to a large [IQueryable<T>](https://learn.microsoft.com/en-us/dotnet/api/system.linq.iqueryable-1) data collection. This data source implementation is based on our [DevExtreme.AspNet.Data](https://github.com/DevExpress/DevExtreme.AspNet.Data) library. When you use this data source, the Grid delegates data filtering operations to an underlying query provider (such as [EF Core](https://learn.microsoft.com/en-us/ef/core/)) and only loads data required for screen display. This technique optimizes performance and reduces overall memory consumption.

To use this data source in your next Blazor project, create a [GridDevExtremeDataSource<T>](https://docs.devexpress.com/Blazor/DevExpress.Blazor.GridDevExtremeDataSource-1) class instance and pass your [IQueryable<T>](https://learn.microsoft.com/en-us/dotnet/api/system.linq.iqueryable-1) data collection as the constructor parameter. Once complete, assign this instance to the Grid's Data property.

Refer to the following help topic for more information about this data source, its specifics, and limitations: [Bind Blazor Grid to Data](https://docs.devexpress.com/Blazor/403737/components/grid/bind-to-data#large-data-queryable-collections).

## Files to Review

- link.cs (VB: link.vb)
- link.js
- ...
- [Index.razor](./CS/BindGridToLargeData/Components/Pages/Index.razor)
- [Index.razor.css](./CS/BindGridToLargeData/Components/Pages/Index.razor.css)
- [Invoice.cs](./CS/BindGridToLargeData/Models/Invoice.cs)
- [NorthwindContext.cs](./CS/BindGridToLargeData/Models/NorthwindContext.cs)
- [Program.cs](./CS/BindGridToLargeData/Program.cs)

## Documentation

- link
- link
- ...
- [Bind Blazor Grid to Data](https://docs.devexpress.com/Blazor/403737/components/grid/bind-to-data)
- [Bind Components to Data with Entity Framework Core](https://docs.devexpress.com/Blazor/403167/common-concepts/data-binding/bind-components-to-data-with-entity-framework-core)

## More Examples

- link
- link
- ...
- [How to bind the Grid to a DataTable object](https://github.com/DevExpress-Examples/blazor-grid-bind-to-datatable-object)
- [How to bind the Grid to data with Entity Framework Core](https://github.com/DevExpress-Examples/blazor-dxgrid-bind-to-data-with-entity-framework-core)
- [How to bind the Grid to an Instant Feedback data source and enable edit operations](https://github.com/DevExpress-Examples/blazor-dxgrid-bind-to-instant-feedback-data-source)
- [How to bind the Grid to a Web API service](https://github.com/DevExpress-Examples/blazor-DxGrid-Bind-To-Web-Api-Service)

<!-- feedback -->
## Does this example address your development requirements/objectives?

Expand Down
Binary file added bind-to-devextreme-data-source.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading