Skip to content

Commit c270597

Browse files
documentation(951750):Updated sample
1 parent deba53a commit c270597

File tree

20 files changed

+286
-10
lines changed

20 files changed

+286
-10
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Angular Grid SQL Server Connectivity using Dapper and CustomAdaptor
2+
3+
A project that enables data binding and CRUD action handling in the Syncfusion Angular Grid to a SQL Server using Dapper (mapping tool) and CustomAdaptor feature of the Grid.
4+
5+
## Steps to Run the Sample
6+
7+
1. Download or unzip the project and open the project in **Visual Studio 2022**.
8+
9+
2. Add the `NORTHWIND.MDF` database located in the `App_Data` folder of the backend project to the application.
10+
11+
3. Replace the connected database's connection string in the `GridController.cs` file.
12+
13+
4. In the Angular client project, open `app.component.ts` and replace the port number in the API URL where it says `xxxx` with the actual backend server port.
14+
15+
5. Navigate to the client project folder and run the following command:
16+
17+
```bash
18+
npm install
19+
```
20+
6. Build the project to restore dependencies and compile it.
21+
22+
7. Run the project.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Angular Grid SQL Server Connectivity using Dapper and URLAdaptor
2+
3+
A project that enables data binding and CRUD action handling in the Syncfusion Angular Grid to a SQL Server using Dapper (mapping tool) and URLAdaptor feature of the Grid.
4+
5+
## Steps to Run the Sample
6+
7+
1. Download or unzip the project and open the project in **Visual Studio 2022**.
8+
9+
2. Add the `NORTHWIND.MDF` database located in the `App_Data` folder of the backend project to the application.
10+
11+
3. Replace the connected database's connection string in the `GridController.cs` file.
12+
13+
4. In the Angular client project, open `app.component.ts` and replace the port number in the API URL where it says `xxxx` with the actual backend server port.
14+
15+
5. Navigate to the client project folder and run the following command:
16+
17+
```bash
18+
npm install
19+
```
20+
6. Build the project to restore dependencies and compile it.
21+
22+
7. Run the project.

Binding MS SQL database using CustomAdaptor/Grid_MSSQL/Grid_MSSQL.Server/Controllers/GridController.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ public class GridController : ControllerBase
1111
{
1212

1313
string ConnectionString = @"<Enter a valid connection string>";
14-
14+
/// <summary>
15+
/// Processes the DataManager request to perform searching, filtering, sorting, and paging operations.
16+
/// </summary>
17+
/// <param name="DataManagerRequest">Contains the details of the data operation requested.</param>
18+
/// <returns>Returns a JSON object with the filtered, sorted, and paginated data along with the total record count.</returns>
1519
[HttpPost]
1620
[Route("api/[controller]")]
1721
public object Post([FromBody] DataManagerRequest DataManagerRequest)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Angular Grid Microsoft SQL Server connectivity using CustomAdaptor
2+
3+
A project that enables data binding and CRUD action handling in the Syncfusion Angular Grid to a Microsoft SQL Server using CustomAdaptor feature of the Grid.
4+
5+
## Steps to Run the Sample
6+
7+
1. Download or unzip the project and open the project in **Visual Studio 2022**.
8+
9+
2. Add the `NORTHWIND.MDF` database located in the `App_Data` folder of the backend project to the application.
10+
11+
3. Replace the connected database's connection string in the `GridController.cs` file.
12+
13+
4. In the Angular client project, open `app.component.ts` and replace the port number in the API URL where it says `xxxx` with the actual backend server port.
14+
15+
5. Navigate to the client project folder and run the following command:
16+
17+
```bash
18+
npm install
19+
```
20+
6. Build the project to restore dependencies and compile it.
21+
22+
7. Run the project.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Angular Grid Microsoft SQL Server connectivity using URLAdaptor
2+
3+
A project that enables data binding and CRUD action handling in the Syncfusion Angular Grid to a Microsoft SQL Server using URLAdaptor feature of the Grid.
4+
5+
## Steps to Run the Sample
6+
7+
1. Download or unzip the project and open the project in **Visual Studio 2022**.
8+
9+
2. Add the `NORTHWIND.MDF` database located in the `App_Data` folder of the backend project to the application.
10+
11+
3. Replace the connected database's connection string in the `GridController.cs` file.
12+
13+
4. In the Angular client project, open `app.component.ts` and replace the port number in the API URL where it says `xxxx` with the actual backend server port.
14+
15+
5. Navigate to the client project folder and run the following command:
16+
17+
```bash
18+
npm install
19+
```
20+
6. Build the project to restore dependencies and compile it.
21+
22+
7. Run the project.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Angular Grid MYSQL connectivity using CustomAdaptor
2+
3+
A project that enables data binding and CRUD action handling in the Syncfusion Angular Grid to a MYSQL Server using CustomAdaptor feature of the Grid.
4+
5+
## Steps to Run the Sample
6+
7+
1. Download or unzip the project and open the project in **Visual Studio 2022**.
8+
9+
2. Replace the connected database's connection string in the `GridController.cs` file.
10+
11+
3. In the Angular client project, open `app.component.ts` and replace the port number in the API URL where it says `xxxx` with the actual backend server port.
12+
13+
4. Navigate to the client project folder and run the following command:
14+
15+
```bash
16+
npm install
17+
```
18+
5. Build the project to restore dependencies and compile it.
19+
20+
6. Run the project.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Angular Grid MYSQL connectivity using URLAdaptor
2+
3+
A project that enables data binding and CRUD action handling in the Syncfusion Angular Grid to a MYSQL Server using URLAdaptor feature of the Grid.
4+
5+
## Steps to Run the Sample
6+
7+
1. Download or unzip the project and open the project in **Visual Studio 2022**.
8+
9+
2. Replace the connected database's connection string in the `GridController.cs` file.
10+
11+
3. In the Angular client project, open `app.component.ts` and replace the port number in the API URL where it says `xxxx` with the actual backend server port.
12+
13+
4. Navigate to the client project folder and run the following command:
14+
15+
```bash
16+
npm install
17+
```
18+
5. Build the project to restore dependencies and compile it.
19+
20+
6. Run the project.

Binding PostgreSQL database using CustomAdaptor/Grid_PostgreSQL_Custom/Grid_PostgreSQL_Custom.Server/Controllers/GridController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class GridController : ControllerBase
1616
/// Processes the DataManager request to perform searching, filtering, sorting, and paging operations.
1717
/// </summary>
1818
/// <param name="DataManagerRequest">Contains the details of the data operation requested.</param>
19-
/// <returns>Returns a JSON object along with the total record count.</returns>
19+
/// <returns>Returns a JSON object with the filtered, sorted, and paginated data along with the total record count.</returns>
2020
[HttpPost]
2121
[Route("api/[controller]")]
2222
public object Post([FromBody] DataManagerRequest DataManagerRequest)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Angular Grid PostgreSQL Server connectivity using CustomAdaptor
2+
3+
A project that enables data binding and CRUD action handling in the Syncfusion Angular Grid to a PostgreSQL Server using CustomAdaptor feature of the Grid.
4+
5+
## Steps to Run the Sample
6+
7+
1. Download or unzip the project and open the project in **Visual Studio 2022**.
8+
9+
2. Replace the connected database's connection string in the `GridController.cs` file.
10+
11+
3. In the Angular client project, open `app.component.ts` and replace the port number in the API URL where it says `xxxx` with the actual backend server port.
12+
13+
4. Navigate to the client project folder and run the following command:
14+
15+
```bash
16+
npm install
17+
```
18+
5. Build the project to restore dependencies and compile it.
19+
20+
6. Run the project.

Binding PostgreSQL database using UrlAdaptor/Grid_PostgreSQL/Grid_PostgreSQL.Server/Controllers/GridController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ public class GridController : ControllerBase
1818
/// Processes the DataManager request to perform searching, filtering, sorting, and paging operations.
1919
/// </summary>
2020
/// <param name="DataManagerRequest">Contains the details of the data operation requested.</param>
21-
/// <returns>Returns a JSON object along with the total record count.</returns>
22-
[HttpPost]
21+
/// <returns>Returns a JSON object with the filtered, sorted, and paginated data along with the total record count.</returns>
22+
[HttpPost]
2323
[Route("api/[controller]")]
2424
public object Post([FromBody] DataManagerRequest DataManagerRequest)
2525
{
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Angular Grid PostgreSQL Server connectivity using URLAdaptor
2+
3+
A project that enables data binding and CRUD action handling in the Syncfusion Angular Grid to a PostgreSQL Server using URLAdaptor feature of the Grid.
4+
5+
## Steps to Run the Sample
6+
7+
1. Download or unzip the project and open the project in **Visual Studio 2022**.
8+
9+
2. Replace the connected database's connection string in the `GridController.cs` file.
10+
11+
3. In the Angular client project, open `app.component.ts` and replace the port number in the API URL where it says `xxxx` with the actual backend server port.
12+
13+
4. Navigate to the client project folder and run the following command:
14+
15+
```bash
16+
npm install
17+
```
18+
5. Build the project to restore dependencies and compile it.
19+
20+
6. Run the project.

Binding SQL database using EF and CustomAdaptor/Grid_EntityFramework/Grid_EntityFramework.Server/Controllers/GridController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class GridController : ControllerBase
1919
/// Processes the DataManager request to perform searching, filtering, sorting, and paging operations.
2020
/// </summary>
2121
/// <param name="DataManagerRequest">Contains the details of the data operation requested.</param>
22-
/// <returns>Returns a JSON object along with the total record count.</returns>
22+
/// <returns>Returns a JSON object with the filtered, sorted, and paginated data along with the total record count.</returns>
2323
[HttpPost]
2424
[Route("api/[controller]")]
2525
public object Post([FromBody] DataManagerRequest DataManagerRequest)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Angular Grid SQL Server connectivity using Entity Framework and CustomAdaptor
2+
3+
A project that enables data binding and CRUD action handling in the Syncfusion Angular Grid to a SQL Server using Entity Framework and CustomAdaptor feature of the Grid.
4+
5+
## Steps to Run the Sample
6+
7+
1. Download or unzip the project and open the project in **Visual Studio 2022**.
8+
9+
2. Add the `NORTHWIND.MDF` database located in the `App_Data` folder of the backend project to the application.
10+
11+
3. Replace the connected database's connection string in the `GridController.cs` file.
12+
13+
4. In the Angular client project, open `app.component.ts` and replace the port number in the API URL where it says `xxxx` with the actual backend server port.
14+
15+
5. Navigate to the client project folder and run the following command:
16+
17+
```bash
18+
npm install
19+
```
20+
6. Build the project to restore dependencies and compile it.
21+
22+
7. Run the project.

Binding SQL database using EF and UrlAdaptor/Grid_EntityFramework/Grid_EntityFramework.Server/Controllers/GridController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class GridController : ControllerBase
2020
/// Processes the DataManager request to perform searching, filtering, sorting, and paging operations.
2121
/// </summary>
2222
/// <param name="DataManagerRequest">Contains the details of the data operation requested.</param>
23-
/// <returns>Returns a JSON object along with the total record count.</returns>
23+
/// <returns>Returns a JSON object with the filtered, sorted, and paginated data along with the total record count.</returns>
2424
[HttpPost]
2525
[Route("api/[controller]")]
2626
public object Post([FromBody] DataManagerRequest DataManagerRequest)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Angular Grid SQL Server Connectivity using Entity Framework and URLAdaptor
2+
3+
A project that enables data binding and CRUD action handling in the Syncfusion Angular Grid to a SQL Server using Entity Framework and URLdaptor feature of the Grid.
4+
5+
## Steps to Run the Sample
6+
7+
1. Download or unzip the project and open the project in **Visual Studio 2022**.
8+
9+
2. Add the `NORTHWIND.MDF` database located in the `App_Data` folder of the backend project to the application.
10+
11+
3. Replace the connected database's connection string in the `GridController.cs` file.
12+
13+
4. In the Angular client project, open `app.component.ts` and replace the port number in the API URL where it says `xxxx` with the actual backend server port.
14+
15+
5. Navigate to the client project folder and run the following command:
16+
17+
```bash
18+
npm install
19+
```
20+
6. Build the project to restore dependencies and compile it.
21+
22+
7. Run the project.

Binding SQLite using CustomAdaptor/Grid_SQLite/Grid_SQLite.Server/Controllers/GridController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class GridController : ControllerBase
1616
/// Processes the DataManager request to perform searching, filtering, sorting, and paging operations.
1717
/// </summary>
1818
/// <param name="DataManagerRequest">Contains the details of the data operation requested.</param>
19-
/// <returns>Returns a JSON object along with the total record count.</returns>
19+
/// <returns>Returns a JSON object with the filtered, sorted, and paginated data along with the total record count.</returns>
2020
[HttpPost]
2121
[Route("api/[controller]")]
2222
public object Post([FromBody] DataManagerRequest DataManagerRequest)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Angular Grid SQLite database connectivity using CustomAdaptor
2+
3+
A project that enables data binding and CRUD action handling in the Syncfusion Angular Grid to a SQLite database using CustomAdaptor feature of the Grid.
4+
5+
## Steps to Run the Sample
6+
7+
1. Download or unzip the project and open the project in **Visual Studio 2022**.
8+
9+
2. Replace the SQLite database's connection string in the `GridController.cs` file.
10+
11+
3. In the Angular client project, open `app.component.ts` and replace the port number in the API URL where it says `xxxx` with the actual backend server port.
12+
13+
4. Navigate to the client project folder and run the following command:
14+
15+
```bash
16+
npm install
17+
```
18+
5. Build the project to restore dependencies and compile it.
19+
20+
6. Run the project.

Binding SQLite using UrlAdaptor/Grid_SQLite/Grid_SQLite.Server/Controllers/GridController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class GridController : ControllerBase
1616
/// Processes the DataManager request to perform searching, filtering, sorting, and paging operations.
1717
/// </summary>
1818
/// <param name="DataManagerRequest">Contains the details of the data operation requested.</param>
19-
/// <returns>Returns a JSON object along with the total record count.</returns>
19+
/// <returns>Returns a JSON object with the filtered, sorted, and paginated data along with the total record count.</returns>
2020
[HttpPost]
2121
[Route("api/[controller]")]
2222
public object Post([FromBody] DataManagerRequest DataManagerRequest)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Angular Grid SQLite database connectivity using URLAdaptor
2+
3+
A project that enables data binding and CRUD action handling in the Syncfusion Angular Grid to a SQLite database using URLAdaptor feature of the Grid.
4+
5+
## Steps to Run the Sample
6+
7+
1. Download or unzip the project and open the project in **Visual Studio 2022**.
8+
9+
2. Replace the SQLite database's connection string in the `GridController.cs` file.
10+
11+
3. In the Angular client project, open `app.component.ts` and replace the port number in the API URL where it says `xxxx` with the actual backend server port.
12+
13+
4. Navigate to the client project folder and run the following command:
14+
15+
```bash
16+
npm install
17+
```
18+
5. Build the project to restore dependencies and compile it.
19+
20+
6. Run the project.

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,22 @@
1-
# connecting-databases-to-angular-grid-component
2-
A suite of projects that enable data binding and CRUD action handling in the Syncfusion Angular Grid from various databases using CustomAdaptor and UrlAdaptor.
1+
# Connecting Database to Syncfusion Angular Grid
2+
3+
This section describes how to connect and retrieve data from a Microsoft SQL Server database using [Microsoft.Data.SqlClient](https://www.nuget.org/packages/Microsoft.Data.SqlClient) and bind it to the Syncfusion Angular Grid.
4+
5+
Microsoft SQL Server database can be bound to the Grid in different ways (i.e.) using `dataSource` property, custom adaptor and remote data binding using various adaptors. In this documentation, two approaches will be examined to connect a Microsoft SQL Server database to a Grid. Both the approaches have capability to handle data and CRUD operations with built-in methods as well as can be customized as per your own.
6+
7+
**1. Using UrlAdaptor**
8+
9+
The [UrlAdaptor](https://ej2.syncfusion.com/angular/documentation/grid/connecting-to-adaptors/url-adaptor?cs-save-lang=1&cs-lang=csharp) serves as the base adaptor for facilitating communication between remote data services and an UI component. It enables the remote binding of data to the Syncfusion Angular Grid by connecting to an existing pre-configured API service linked to the Microsoft SQL Server database. While the Grid supports various adaptors to fulfill this requirement, including [Web API](https://ej2.syncfusion.com/angular/documentation/grid/connecting-to-adaptors/web-api-adaptor), [ODataV4](https://ej2.syncfusion.com/angular/documentation/grid/connecting-to-adaptors/odatav4-adaptor), [UrlAdaptor](https://ej2.syncfusion.com/angular/documentation/grid/connecting-to-adaptors/url-adaptor?cs-save-lang=1&cs-lang=csharp), and [GraphQL](https://ej2.syncfusion.com/angular/documentation/grid/connecting-to-adaptors/graphql-adaptor), the `UrlAdaptor` is particularly useful for the scenarios where a custom API service with unique logic for handling data and CRUD operations is in place. This approach allows for custom handling of data and CRUD operations, and the resultant data returned in the `result` and `count` format for display in the Grid.
10+
11+
**2. Using CustomAdaptor**
12+
13+
The [CustomAdaptor](https://ej2.syncfusion.com/angular/documentation/grid/connecting-to-adaptors/custom-adaptor) serves as a mediator between the UI component and the database for data binding. While the data source from the database can be directly bound to the Syncfusion Angular Grid locally using the `dataSource` property, the `CustomAdaptor` approach is preferred as it allows for customization of both data operations and CRUD operations according to specific requirements. In this approach, for every action in the Grid, a corresponding request with action details is sent to the `CustomAdaptor`. The Grid provides predefined methods to perform data operations such as **searching**, **filtering**, **sorting**, **aggregation**, **paging** and **grouping**. Alternatively, your own custom methods can be employed to execute operations and return the data in the `result` and `count` format for displaying in the Grid. Additionally, for CRUD operations, predefined methods can be overridden to provide custom functionality. Further details on this can be found in the later part of the documentation.
14+
15+
Here, we have explained in detail how to bind the listed databases below to the Blazor DataGrid component using CustomAdaptor and UrlAdaptor.
16+
17+
1. Microsoft SQL Server Database
18+
2. MYSQL Database
19+
3. PostgreSQL Database
20+
4. Dapper
21+
5. SQLite
22+
6. Entity Framework

0 commit comments

Comments
 (0)