-
Notifications
You must be signed in to change notification settings - Fork 73
1000511 :Revamp sql server using Entity framework #7372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: hotfix/hotfix-v32.1.19
Are you sure you want to change the base?
1000511 :Revamp sql server using Entity framework #7372
Conversation
|
Build Status: INPROGRESS 🔃 |
|
CI Status: FAILURE ❌ |
|
|
||
| In this section, you can learn how to retrieve data from SQL database using [Entity Framework](https://learn.microsoft.com/en-us/ef/core/) to bind it to the Grid component and perform CRUD operations. | ||
| Entity Framework is an open-source object-relational mapper (O/RM) from Microsoft. Entity Framework works with many databases. But here, we are going to discuss the step-by-step procedure to create an Entity Framework using the [MS SQL Server](https://en.wikipedia.org/wiki/Microsoft_SQL_Server) database and connect it to the Syncfusion<sup style="font-size:70%">®</sup> component to perform CRUD operations in a Blazor Server Application. | ||
| This section explains how to retrieve data from a SQL Server database using Entity Framework and bind it to the Blazor Grid component for performing Create, Read, Update, and Delete (CRUD) operations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
link is missing Entity Framework
| ## Bind data to Blazor DataGrid component using Entity Framework | ||
|
|
||
| To consume data from the database using **Entity Framework**, you need to inject the LibraryService into the razor page and assign it to the DataGrid’s datasource variable. Here, the **DataSource** property of the DataGrid component is used to bind the SQL data using Entity Framework in the Server-side application | ||
| To consume data from the database using Entity Framework, the `LibraryService` must be injected into the Razor page and assigned to the DataGrid’s `DataSource` property. The `DataSource` property of the DataGrid component is responsible for binding SQL Server data retrieved through Entity Framework in a Blazor Server application, enabling seamless data display and interaction. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Entity Framework asterisk sign is missing for Entity Framework
DataSource asterisk sign is missing for DataSource
| Here, inline edit mode and the **Toolbar** property are used to display toolbar items for editing. | ||
| When using the `DataSource` property of the Grid, changes are reflected only in the Grid’s local datasource. To ensure that changes are also updated in the database, CRUD operations must be handled externally through the Grid’s row-level events. | ||
|
|
||
| - **RowUpdating** – Triggered when a record is added or edited. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to confirm once and add new events API link
|
|
||
| * **OnActionBegin** – This event will be triggered when the action gets initiated. So, while inserting/updating a record, RequestType Save will be sent in the event arguments to save the changes in the database. Similarly, while deleting a record, RequestType as Delete will be initiated to perform actions externally. Since for both Update and Insert action, RequestType will be Save, you can differentiate them by using the Args.Action property, which will indicate the current action. | ||
| * **OnActionComplete** – It will be triggered when certain actions are completed. Here, you can refresh the Grid component with an updated datasource to reflect the changes. | ||
| - **RowDeleting** – Triggered when a record is removed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to confirm once and add new events API link
| By handling these events, the Grid remains synchronized with the database. The editing and toolbar features can be combined with these row-level events to provide complete CRUD functionality with the existing Grid model. | ||
|
|
||
|
|
||
| We have added the DataGrid editing, toolbar, and RowUpdating and RowDeleting event code with the previous Grid model. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to confirm once and add new events API link
|  | ||
|
|
||
| Clicking the **Update** toolbar button will initiate the insert action in Grid. Now, the **OnActionBegin** event will be triggered with a **RequestType** as **Save**. You can insert the record into the database (Book table) by calling the **InsertBook()** method of the `ClientServices` in Blazor Web App(BlazorWebApp.Shared project) and `LibraryService` in Blazor Server App. | ||
| After clicking the **Add** button in Blazor, use the **Update** toolbar button to confirm the insert action. At this point, the **RowUpdating** event with the **Added** action will be triggered, and this can be used to insert the new record into the `Book` table by calling the `InsertBook()` method of the `ClientServices` in the Blazor Web App (`BlazorWebApp.Shared` project) and the `LibraryService` in the Blazor Server App. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After clicking the Add button in Blazor,
not clear
|
Build Status: INPROGRESS 🔃 |
|
CI Status: FAILURE ❌ |
Revamp the sample and documentation on binding data from SQL Server to Syncfusion® Blazor components using Entity Framework in .NET.