dotConnect for Adobe Commerce Documentation
Retrieving Data

Introduction

This tutorial describes how to use MagentoCommand, MagentoDataReader, and MagentoDataAdapter components.

Requirements

This tutorial supposes that you know how to connect to server.

Note that if you do not use design-time (specifically, if you do not place on a designer MagentoConnection component from toolbox), you have to embed license information manually. This is described in the Licensing topic.

General Information

The main function of any database application is establishing a connection to a data source and working with data contained in it. ADO.NET data providers serve as a bridge between an application and a data source, and allow you to execute commands as well as to retrieve data by using a DataReader or a DataAdapter. Updating data involves using the Command and DataAdapter objects.

Retrieving Data using MagentoCommand and MagentoDataReader

In this sample we will use MagentoCommand and MagentoDataReader to retrieve data. MagentoDataReader allows retrieving data in pages. While you read data from it, it automatically queries next pages from Adobe Commerce. MagentoDataReader offers higher performance than MagentoDataAdapter, especially when you query a lot of data. For more information, refer to the description of these classes in our documentation.

using Devart.Data.Magento;
...
class Program
{

}
Imports Devart.Data.Magento
...
Module Module1


End Module


Retrieving Data using MagentoDataAdapter

Applicable only for projects targeting full .NET Framework.

In this sample we will use the MagentoDataAdapter component. It retrieves data when you call its Fill method. Note that this method needs to retrieve all the queried data from Adobe Commerce, and it can take some time.

Here is a small sample that demonstrates usage of MagentoDataAdapter to retrieve data.

Additional Information

This tutorial describes only basic ways of working with data. For example, you can take advantage of using Entity Framework ORM technology which is intended for converting data between incompatible type systems in different data sources and object-oriented programming languages. This technology allow you to decrease the amount of code and maintenance required for data-oriented applications. For more information, please refer to Entity Framework section.

See Also

Entity Framework  | Updating Data