This tutorial describes how to use the MagentoCommand, MagentoDataReader, and MagentoDataAdapter components.
This tutorial assumes that you know how to connect to Adobe Commerce.
Note that if you do not use design time (specifically, if you do not place a MagentoConnection component from the toolbox on a designer), you have to embed license information manually. This is described in the Licensing topic.
The main function of any database application is establishing a connection to a data source and working with the data it contains. ADO.NET data providers serve as a bridge between an application and a data source and allow you to execute commands as well as retrieve data using a DataReader or a DataAdapter. Updating data involves using the Command and DataAdapter objects.
In this sample, we use MagentoCommand and MagentoDataReader to retrieve data. MagentoDataReader retrieves data in pages: while you read from it, it automatically requests the 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.
In this sample, we use the MagentoDataAdapter component. It retrieves data when you call its Fill method. Note that this method retrieves all the queried data from Adobe Commerce, which can take some time.
Here is a small sample that demonstrates how to use MagentoDataAdapter to retrieve data.
This tutorial describes only the basic ways of working with data. You can also use the 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 allows you to reduce the amount of code and maintenance required for data-oriented applications. For more information, see the Entity Framework section.