Example with dapper and Model

I followed the example for Dapper and created the model, DataAdapter and DataAcessLayer.

I do not get any data from a SQL server database. The connection string is correct.

I placed breakpoints everywhere and none every got fired. 


How do I debug why I don't get data?

Thanks.



3 Replies

PS Prathap Senthil Syncfusion Team May 14, 2024 12:55 PM UTC

Hi Roger,

Based on the query, we suggest setting the breakpoint in the ReadAsync method. Here, you can validate whether to retrieve the data or not. Kindly refer to the code snippet below and the UG documentation for your reference

  public class CustomAdaptor : DataAdaptor

  {

      public OrderData OrderService = new OrderData();

      public override async Task<object> ReadAsync(DataManagerRequest DataManagerRequest, string Key = null)

      {

          IEnumerable<Order> DataSource = await OrderService.GetOrdersAsync();

          // Handling Searching in CustomAdaptor.

          if (DataManagerRequest.Search != null && DataManagerRequest.Search.Count > 0)

          {

              // Searching

              DataSource = DataOperations.PerformSearching(DataSource, DataManagerRequest.Search);

          }

  


Reference:
https://blazor.syncfusion.com/documentation/datagrid/connecting-to-database/dapper#binding-data-from-microsoft-sql-server-using-dapper

https://github.com/SyncfusionExamples/connecting-databases-to-blazor-datagrid-component/tree/master/Binding%20Dapper%20using%20CustomAdaptor


Regards,
Prathap Senthil



RO Roger replied to Prathap Senthil May 14, 2024 02:07 PM UTC

Bind data using Dapper and perform CRUD operations | Syncfusion this is the example I am trying to get to work,



PS Prathap Senthil Syncfusion Team May 15, 2024 02:08 PM UTC


Thanks for the update,


We are happy to hear that the provided solution was helpful. Please get back to us if you have faced any difficulties.


Loader.
Up arrow icon