Getting Started With dotConnect for Adobe Commerce

Below are some resources to help you maximize your experience with dotConnect for Adobe Commerce.

dotConnect for Adobe Commerce is a high-performance ADO.NET data provider with ORM support, offering fast and encrypted access to Adobe Commerce (formerly Magento) data for application development.

  • EF Core, Dapper, and NHibernate support
  • Local SQL engine with support for SQL-92
  • Broad compatibility with various .NET platforms and versions
  • Full compliance with ADO.NET
  • Integration with Visual Studio

Code examples

using Devart.Data.Magento;
 
namespace MagentoConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string domain = "https://testdomain.com/";
            string user = "TestUser";
            string password = "TestPassword";
            string licenseKey = "***********";
 
            string connectionString = $"Domain={domain};Service Version=Ver2;User={user};Password={password};License Key={licenseKey}";
 
            try
            {
                CheckConnectionStatus(connectionString);
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occurred: " + ex.Message);
            }
        }
 
        public static void CheckConnectionStatus(string myConnString)
        {
            using (MagentoConnection magentoConnection = new MagentoConnection(myConnString))
            {
                try
                {
                    magentoConnection.Open();
                    Console.WriteLine("Connection successful.");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Connection failed: " + ex.Message);
                }
            }
        }
    }
}
PM> Install-Package Devart.Data.Magento
using Devart.Data.Magento;

namespace MagentoConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string domain = "https://testdomain.com/";
            string user = "TestUser";
            string password = "TestPassword";
            string licenseKey = "***********";

            string connectionString = $"Domain={domain};Service Version=Ver2;User={user};Password={password};License Key={licenseKey}";

            try
            {
                ReadCustomersData(connectionString);
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occurred: " + ex.Message);
            }
        }

        public static void ReadCustomersData(string myConnString)
        {
            using (MagentoConnection magentoConnection = new MagentoConnection(myConnString))
            {
                try
                {
                    magentoConnection.Open();
                    Console.WriteLine("Connection successful.");
                    Console.WriteLine();
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Connection failed: " + ex.Message);
                    Console.WriteLine();
                    return;
                }

                using (MagentoCommand magentoCommand = (MagentoCommand)magentoConnection.CreateCommand())
                {
                    magentoCommand.CommandText = "SELECT Id, Email FROM Customers";

                    using (MagentoDataReader magentoReader = magentoCommand.ExecuteReader())
                    {
                        try
                        {
                            int rowCount = 0;
                            while (magentoReader.Read() && rowCount < 15)
                            {
                                Console.WriteLine($"Id: {magentoReader["Id"]}");
                                Console.WriteLine($"Email: {magentoReader["Email"]}");
                                Console.WriteLine();
                                rowCount++;
                            }
                        }
                        finally
                        {
                            magentoReader.Close();
                        }
                    }
                }
            }
        }
    }
}
PM> Install-Package Devart.Data.Magento
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using MagentoEFCore;
 
// Build configuration
var configuration = new ConfigurationBuilder()
    .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
    .Build();
 
// Get connection string
var connectionString = configuration.GetConnectionString("magentoModelConnectionString");
 
// Configure DbContext
var optionsBuilder = new DbContextOptionsBuilder();
optionsBuilder.UseMagento(connectionString);
 
// Create DbContext instance
using (var db = new magentoModel(optionsBuilder.Options))
{
    Console.WriteLine("Customers Table:");
 
    // Print header
    Console.WriteLine("{0,-25} | {1,-15} | {2,-30}", "First Name", "Last Name", "Email");
    Console.WriteLine(new string('-', 75));
 
    // Query and display customers
    var customers = db.Customers.Take(10).ToList();
    foreach (var customer in customers)
    {
        Console.WriteLine("{0,-25} | {1,-15} | {2,-30}",
            customer.FirstName,
            customer.LastName,
            customer.Email);
    }
}
PM> Install-Package Devart.Data.Magento.EFCore
using Devart.Data.Magento;

namespace MagentoConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string domain = "https://testdomain.com/";
            string user = "TestUser";
            string password = "TestPassword";
            string licenseKey = "***********";

            string connectionString = $"Domain={domain};Service Version=Ver2;User={user};Password={password};License Key={licenseKey}";

            try
            {
                FetchCustomersWithDataAdapter(connectionString);
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occurred: " + ex.Message);
            }
        }

        public static void FetchCustomersWithDataAdapter(string myConnString)
        {
            using (MagentoConnection magentoConnection = new MagentoConnection(myConnString))
            {
                try
                {
                    magentoConnection.Open();
                    Console.WriteLine("Connection successful.");
                    Console.WriteLine();

                    MagentoDataAdapter magentoDataAdapter = new MagentoDataAdapter("SELECT Id, FirstName, LastName, Email FROM Customers", magentoConnection);

                    DataSet dataSet = new DataSet();

                    magentoDataAdapter.Fill(dataSet);

                    if (dataSet.Tables.Count > 0)
                    {
                        DataTable customersTable = dataSet.Tables[0];
                        int rowCount = 0;

                        foreach (DataRow row in customersTable.Rows)
                        {
                            if (rowCount >= 15)
                                break;

                            Console.WriteLine($"Id: {row["Id"]}");
                            Console.WriteLine($"First Name: {row["FirstName"]}");
                            Console.WriteLine($"Last Name: {row["LastName"]}");
                            Console.WriteLine($"Email: {row["Email"]}");
                            Console.WriteLine();
                            rowCount++;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Connection failed: " + ex.Message);
                }
            }
        }
    }
}
PM> Install-Package Devart.Data.Magento

How-to articles

.NET Connection String for Adobe Commerce
Learn how to set up connection strings properly when working with dotConnect for Adobe Commerce in .NET applications.
Connect to Adobe Commerce in .NET
Explore how to establish a connection between .NET applications and Adobe Commerce using ADO.NET.
Connect to Adobe Commerce with EF Core
Find out how to connect Adobe Commerce to your application using EF Core and ADO.NET for a ready-to-use data access layer.

Documentation

Licensing
Licensing
A detailed technical reference on embedding license information—a required resource for applications built with dotConnect for Adobe Commerce.
DataAdapter features
DataAdapter features
A guide to using the MagentoDataAdapter class for interacting with Adobe Commerce data in a disconnected architecture.
Parameters
Parameters
An overview of SQL query parameters and their synchronization, along with practical insights into working with stored procedures.
SQL translation
SQL translation
A guide on translatable SQL for optimal query performance with remote execution instead of client-side processing.

dotConnect Universal

Get universal access to data from a variety of sources, including SQL Server, Oracle, PostgreSQL, MySQL, SQLite, DB2, InterBase, Microsoft Access, and Firebird. Other servers can be accessed through their ADO.NET, OLE DB and ODBC providers.

FAQ

What is the trial period for dotConnect for Adobe Commerce?
dotConnect for Adobe Commerce offers a fully functional 30-day trial. During this period, you can use and evaluate all features without limitations. After the trial ends, you can purchase a license to continue using the product.
Why do I need to install the product if NuGet is available?

dotConnect for Adobe Commerce provides two sets of assemblies, and the choice depends on your project type:

  • For .NET (.NET Core/.NET 5+) projects: Use the assemblies available via NuGet packages.
  • For .NET Framework projects: Use the Devart assemblies included with the product installer.
Where should I apply my License Key?

Add the License Key parameter to your connection string together with other connection parameters. For more information, refer to the Licensing section of the documentation.

Do the end users of my application require a Devart license, or must I pay additional fees for deploying my software?

No, end users do not need a Devart license, and there are no additional deployment fees as long as you hold a valid Devart license.

According to the EULA, you're allowed to redistribute the following runtime assemblies with your application:

  • Devart.Data.Magento.dll
  • Devart.Data.dll

You can include them in your app's folder (such as Bin for web apps) or register them in the GAC. Make sure they are used only by your solution.

A full installation on the target machine is not required. You can use the "Minimal installation" option provided by the setup.

No other components of dotConnect may be distributed.

How can I update dotConnect to a new version?

To update dotConnect to a new version, you need to reinstall it:

  1. Open Settings > Apps > Installed apps in Windows.
  2. Uninstall the current and any older versions of dotConnect, including Entity Developer and LinqConnect, if installed.
  3. Visit the Customer Portal and download the latest licensed version.
  4. Install the downloaded version and receive the latest features and improvements.
How can I completely remove all the previous versions of the product?

1. Go to Settings > Apps > Installed apps and uninstall:

  • All dotConnect providers
  • Entity Developer
  • LinqConnect

2. Manually delete any leftover files from the following locations (if they exist):

GAC folders:

  • C:\Windows\assembly\GAC_MSIL
  • C:\Windows\Microsoft.NET\assembly\GAC_MSIL

Program files and extensions:

  • C:\Program Files (x86)\Microsoft Visual Studio\...\Community\Common7\IDE\Extensions\Devart
  • C:\Program Files\Microsoft Visual Studio\...\Community\Common7\IDE\Extensions\Devart
  • C:\Program Files (x86)\Devart
  • C:\Program Files\Devart
  • C:\Program Files (x86)\Common Files\Devart
  • C:\Program Files\Common Files\Devart

Program data folders:

  • C:\ProgramData\Devart\dotConnect
  • C:\ProgramData\Devart\Entity Developer

Removing these ensures a clean system and prevents conflicts during future installations.

Wield the full firepower of dotConnect for Adobe Commerce
Go with the advanced edition of dotConnect for Adobe Commerce and stay at the top of your game from day one!