You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blazor/datagrid/connecting-to-database/postgresql-server.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ documentation: ug
12
12
The Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid component supports binding data from a [PostgreSQL](https://www.nuget.org/packages/Npgsql.EntityFrameworkCore.PostgreSQL) Server database using multiple approaches. Common methods include:
13
13
14
14
- Using the [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_DataSource) property for local binding.
15
-
- Implementing a [CustomAdaptor](https://blazor.syncfusion.com/documentation/datagrid/custom-binding) for custom logic.
15
+
- Implementing a [CustomAdaptor](https://blazor.syncfusion.com/documentation/datagrid/connecting-to-adaptors/custom-adaptor) for custom logic.
16
16
- Configuring remote data binding through adaptors such as [UrlAdaptor](https://blazor.syncfusion.com/documentation/data/adaptors#url-adaptor).
17
17
18
18
This section explains how to connect and retrieve data from a PostgreSQL Server database using [Npgsql EntityFrameworkCore PostgreSQL](https://www.nuget.org/packages/Npgsql.EntityFrameworkCore.PostgreSQL) and bind the data to a Blazor DataGrid component through the following methods:
@@ -50,7 +50,7 @@ Add a controller named **GridController.cs** under the **Controllers** folder. T
50
50
Use **NpgsqlConnection**, **NpgsqlCommand**, and **NpgsqlDataAdapter** to execute queries and fetch data from **PostgreSQL**. Populate the data into a DataTable and convert it into a strongly typed collection.
51
51
52
52
{% tabs %}
53
-
{% highlight razor tabtitle="GridController.cs"%}
53
+
{% highlight razor tabtitle="GridController.cs"%}
54
54
using Microsoft.AspNetCore.Mvc;
55
55
using Npgsql;
56
56
using System.Data;
@@ -186,7 +186,7 @@ Access the theme stylesheet and script from NuGet using [Static Web Assets](http
186
186
The [DataManager](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Data.SfDataManager.html) component supports multiple adaptors for remote data binding. For API services, set the [Adaptor](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Adaptors.html) property to [Adaptors.UrlAdaptor](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Adaptors.html#Syncfusion_Blazor_Adaptors_UrlAdaptor) and specify the service endpoint in the [Url](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DataManager.html#Syncfusion_Blazor_DataManager_Url) property.
187
187
188
188
{% tabs %}
189
-
{% highlight razor tabtitle="Index.razor"%}
189
+
{% highlight razor tabtitle="Index.razor"%}
190
190
@using Syncfusion.Blazor.Grids
191
191
@using Syncfusion.Blazor.Data
192
192
@using Syncfusion.Blazor
@@ -246,7 +246,7 @@ The [DataManager](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Data.S
246
246
}
247
247
}
248
248
{% endhighlight %}
249
-
{% highlight c# tabtitle="GridController.cs"%}
249
+
{% highlight c# tabtitle="GridController.cs"%}
250
250
[ApiController]
251
251
public class GridController : ControllerBase
252
252
{
@@ -683,7 +683,7 @@ Inject a custom service into the `CustomAdaptor` and configure the component as
683
683
SfGrid<Order> Grid { get; set; }
684
684
}
685
685
{% endhighlight %}
686
-
{% highlight razor tabtitle="Orderdata.cs"%}
686
+
{% highlight razor tabtitle="Orderdata.cs"%}
687
687
public class Order
688
688
{
689
689
public int? OrderID { get; set; }
@@ -1094,7 +1094,7 @@ Each method can be customized to execute SQL commands against the **PostgreSQL**
1094
1094
To implement record insertion, override the [Insert](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DataAdaptor.html#Syncfusion_Blazor_DataAdaptor_Insert_Syncfusion_Blazor_DataManager_System_Object_System_String_) or [InsertAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DataAdaptor.html#Syncfusion_Blazor_DataAdaptor_InsertAsync_Syncfusion_Blazor_DataManager_System_Object_System_String_) method in the `CustomAdaptor` class.
1095
1095
1096
1096
{% tabs %}
1097
-
{% highlight razor tabtitle="Index.razor"%}
1097
+
{% highlight razor tabtitle="Index.razor"%}
1098
1098
/// <summary>
1099
1099
/// Inserts a new data item into the data collection.
1100
1100
/// </summary>
@@ -1110,7 +1110,7 @@ public override async Task<object> InsertAsync(DataManager DataManager, object V
1110
1110
return Value;
1111
1111
}
1112
1112
{% endhighlight %}
1113
-
{% highlight razor tabtitle="Orderdata.cs"%}
1113
+
{% highlight razor tabtitle="Orderdata.cs"%}
1114
1114
public async Task AddOrderAsync(Order Value)
1115
1115
{
1116
1116
// Create query to insert the specific into the database by accessing its properties
@@ -1131,7 +1131,7 @@ public async Task AddOrderAsync(Order Value)
1131
1131
To implement record updates, override the [Update](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DataAdaptor.html#Syncfusion_Blazor_DataAdaptor_Update_Syncfusion_Blazor_DataManager_System_Object_System_String_System_String_) or [UpdateAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DataAdaptor.html#Syncfusion_Blazor_DataAdaptor_UpdateAsync_Syncfusion_Blazor_DataManager_System_Object_System_String_System_String_) method in the `CustomAdaptor` class.
1132
1132
1133
1133
{% tabs %}
1134
-
{% highlight razor tabtitle="Index.razor"%}
1134
+
{% highlight razor tabtitle="Index.razor"%}
1135
1135
/// <summary>
1136
1136
/// Updates an existing data item in the data collection.
1137
1137
/// </summary>
@@ -1148,7 +1148,7 @@ public override async Task<object> UpdateAsync(DataManager DataManager, object V
1148
1148
return Value;
1149
1149
}
1150
1150
{% endhighlight %}
1151
-
{% highlight razor tabtitle="Orderdata.cs"%}
1151
+
{% highlight razor tabtitle="Orderdata.cs"%}
1152
1152
public async Task UpdateOrderAsync(Order Value)
1153
1153
{
1154
1154
//Create query to update the changes into the database by accessing its properties
@@ -1169,7 +1169,7 @@ public async Task UpdateOrderAsync(Order Value)
1169
1169
To perform record deletion, override the [Remove](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DataAdaptor.html#Syncfusion_Blazor_DataAdaptor_Remove_Syncfusion_Blazor_DataManager_System_Object_System_String_System_String_) or [RemoveAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DataAdaptor.html#Syncfusion_Blazor_DataAdaptor_RemoveAsync_Syncfusion_Blazor_DataManager_System_Object_System_String_System_String_) method in the `CustomAdaptor` class.
1170
1170
1171
1171
{% tabs %}
1172
-
{% highlight razor tabtitle="Index.razor"%}
1172
+
{% highlight razor tabtitle="Index.razor"%}
1173
1173
/// <summary>
1174
1174
/// Removes a data item from the data collection.
1175
1175
/// </summary>
@@ -1186,7 +1186,7 @@ public override async Task<object> RemoveAsync(DataManager DataManager, object V
1186
1186
return Value;
1187
1187
}
1188
1188
{% endhighlight %}
1189
-
{% highlight razor tabtitle="Orderdata.cs"%}
1189
+
{% highlight razor tabtitle="Orderdata.cs"%}
1190
1190
public async Task RemoveOrderAsync(int? Key)
1191
1191
{
1192
1192
//Create query to remove the specific from database by passing the primary key column value.
Copy file name to clipboardExpand all lines: blazor/datagrid/connecting-to-database/sqlite-server.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ Create a controller named **GridController.cs** under the Controllers folder.
52
52
Use **SqliteConnection** and **SqliteCommand** to execute queries and populate a collection of model objects.
53
53
54
54
{% tabs %}
55
-
{% highlight razor tabtitle="GridController.cs"%}
55
+
{% highlight razor tabtitle="GridController.cs"%}
56
56
using Microsoft.AspNetCore.Mvc;
57
57
using System.Data;
58
58
using System.Data.SqlClient;
@@ -197,7 +197,7 @@ Access the theme stylesheet and script from NuGet using [Static Web Assets](http
197
197
The [SfDataManager](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Data.SfDataManager.html) component supports multiple adaptors for remote data binding. For API services, set the [Adaptor](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Adaptors.html) property to [Adaptors.UrlAdaptor](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Adaptors.html#Syncfusion_Blazor_Adaptors_UrlAdaptor) and specify the service endpoint in the [Url](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DataManager.html#Syncfusion_Blazor_DataManager_Url) property.
198
198
199
199
{% tabs %}
200
-
{% highlight razor tabtitle="Index.razor"%}
200
+
{% highlight razor tabtitle="Index.razor"%}
201
201
@using Syncfusion.Blazor.Grids
202
202
@using Syncfusion.Blazor.Data
203
203
@using Syncfusion.Blazor
@@ -259,7 +259,7 @@ The [SfDataManager](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Data
259
259
}
260
260
}
261
261
{% endhighlight %}
262
-
{% highlight c# tabtitle="GridController.cs"%}
262
+
{% highlight c# tabtitle="GridController.cs"%}
263
263
public class GridController : ControllerBase
264
264
{
265
265
/// <summary>
@@ -697,7 +697,7 @@ Inject a custom service into the `CustomAdaptor` and configure the component as
697
697
SfGrid<Order> Grid { get; set; }
698
698
}
699
699
{% endhighlight %}
700
-
{% highlight razor tabtitle="Orderdata.cs"%}
700
+
{% highlight razor tabtitle="Orderdata.cs"%}
701
701
public class Order
702
702
{
703
703
public int? OrderID { get; set; }
@@ -1115,7 +1115,7 @@ Each method can be customized to execute SQL commands against the **SQLite Serve
1115
1115
To implement record insertion, override the [Insert](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DataAdaptor.html#Syncfusion_Blazor_DataAdaptor_Insert_Syncfusion_Blazor_DataManager_System_Object_System_String_) or [InsertAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DataAdaptor.html#Syncfusion_Blazor_DataAdaptor_InsertAsync_Syncfusion_Blazor_DataManager_System_Object_System_String_) method in the `CustomAdaptor` class.
1116
1116
1117
1117
{% tabs %}
1118
-
{% highlight razor tabtitle="Index.razor"%}
1118
+
{% highlight razor tabtitle="Index.razor"%}
1119
1119
/// <summary>
1120
1120
/// Inserts a new data item into the data collection.
1121
1121
/// </summary>
@@ -1131,7 +1131,7 @@ public override async Task<object> InsertAsync(DataManager DataManager, object V
1131
1131
return Value;
1132
1132
}
1133
1133
{% endhighlight %}
1134
-
{% highlight razor tabtitle="Orderdata.cs"%}
1134
+
{% highlight razor tabtitle="Orderdata.cs"%}
1135
1135
public async Task AddOrderAsync(Order Value)
1136
1136
{
1137
1137
//Create query to insert the specific into the database by accessing its properties
@@ -1152,7 +1152,7 @@ public async Task AddOrderAsync(Order Value)
1152
1152
To implement record updates, override the [Update](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DataAdaptor.html#Syncfusion_Blazor_DataAdaptor_Update_Syncfusion_Blazor_DataManager_System_Object_System_String_System_String_) or [UpdateAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DataAdaptor.html#Syncfusion_Blazor_DataAdaptor_UpdateAsync_Syncfusion_Blazor_DataManager_System_Object_System_String_System_String_) method in the `CustomAdaptor` class.
1153
1153
1154
1154
{% tabs %}
1155
-
{% highlight razor tabtitle="Index.razor"%}
1155
+
{% highlight razor tabtitle="Index.razor"%}
1156
1156
/// <summary>
1157
1157
/// Updates an existing data item in the data collection.
1158
1158
/// </summary>
@@ -1169,7 +1169,7 @@ public override async Task<object> UpdateAsync(DataManager DataManager, object V
1169
1169
return Value;
1170
1170
}
1171
1171
{% endhighlight %}
1172
-
{% highlight razor tabtitle="Orderdata.cs"%}
1172
+
{% highlight razor tabtitle="Orderdata.cs"%}
1173
1173
public async Task UpdateOrderAsync(Order Value)
1174
1174
{
1175
1175
//Create query to update the changes into the database by accessing its properties
@@ -1190,7 +1190,7 @@ public override async Task<object> UpdateAsync(DataManager DataManager, object V
1190
1190
To perform record deletion, override the [Remove](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DataAdaptor.html#Syncfusion_Blazor_DataAdaptor_Remove_Syncfusion_Blazor_DataManager_System_Object_System_String_System_String_) or [RemoveAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DataAdaptor.html#Syncfusion_Blazor_DataAdaptor_RemoveAsync_Syncfusion_Blazor_DataManager_System_Object_System_String_System_String_) method in the `CustomAdaptor` class.
1191
1191
1192
1192
{% tabs %}
1193
-
{% highlight razor tabtitle="Index.razor"%}
1193
+
{% highlight razor tabtitle="Index.razor"%}
1194
1194
/// <summary>
1195
1195
/// Removes a data item from the data collection.
1196
1196
/// </summary>
@@ -1207,7 +1207,7 @@ public override async Task<object> RemoveAsync(DataManager DataManager, object V
1207
1207
return Value;
1208
1208
}
1209
1209
{% endhighlight %}
1210
-
{% highlight razor tabtitle="Orderdata.cs"%}
1210
+
{% highlight razor tabtitle="Orderdata.cs"%}
1211
1211
public async Task RemoveOrderAsync(int? Key)
1212
1212
{
1213
1213
//Create query to remove the specific from database by passing the primary key column value.
0 commit comments