Getting Started With dotConnect for MailChimp

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

dotConnect for MailChimp is a high-performance ADO.NET data provider with ORM support, offering fast and encrypted access to Mailchimp data for application development.

  • EF Core, Dapper, and NHibernate ORM 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.MailChimp;

namespace MailChimpConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string connectionString = "Authentication Type=OAuthInteractive;License key=**********";

            try
            {
                using (MailChimpConnection connection = new MailChimpConnection(connectionString))
                {
                    connection.Open();
                    Console.WriteLine("Connection successful.");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occurred: " + ex.Message);
            }
        }

    }
}
PM> Install-Package Devart.Data.MailChimp
using Devart.Data.MailChimp;

namespace MailChimpConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {

            string connectionString = "Authentication Type=OAuthInteractive;" +
                                      $"APIKey=**********;" +
                                      $"ClientId=**********;" +
                                      $"ClientSecret=**********;" +
                                      "License key=**********";

            try
            {
                using (MailChimpConnection connection = new MailChimpConnection(connectionString))
                {
                    connection.Open();
                    Console.WriteLine("Connection successful.");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occurred: " + ex.Message);
            }
        }

    }
}
PM> Install-Package Devart.Data.MailChimp
using System;
using System.Data;
using Devart.Data.MailChimp;

namespace MailChimpConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string connectionString = "Authentication Type=OAuthInteractive;License key=**********";

            try
            {
                using (MailChimpConnection connection = new MailChimpConnection(connectionString))
                {
                    connection.Open();
                    Console.WriteLine("Connection successful.");

                    string sql = "SELECT t.Email, t.ListId, t.FullName, t.LastUpdate, t.CreatedDate FROM ListMembers t";

                    using (MailChimpCommand command = new MailChimpCommand(sql, connection))
                    using (MailChimpDataAdapter adapter = new MailChimpDataAdapter(command))
                    {
                        DataTable listMembersTable = new DataTable();
                        adapter.Fill(listMembersTable);

                        foreach (DataRow row in listMembersTable.Rows)
                        {
                            string email = row.Field("Email") ?? string.Empty;
                            string listId = row.Field("ListId") ?? string.Empty;
                            string fullName = row.Field("FullName") ?? string.Empty;
                            DateTime? lastUpdate = row.Field("LastUpdate");
                            DateTime? createdDate = row.Field("CreatedDate");

                            Console.WriteLine($"Email: {email} | ListId: {listId} | Name: {fullName} | Last Update: {lastUpdate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "N/A"} | Created: {createdDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "N/A"}");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occurred: " + ex.Message);
            }
        }
    }
}
PM> Install-Package Devart.Data.MailChimp
using System;
using System.Linq;

namespace MailchimpEFCore
{
    class Program
    {
        static void DisplayListMembers()
        {
            using (var context = new MailchimpModel())
            {
                var listMembers = context.ListMembers
                    .Select(t => new { t.Email, t.ListId, t.FullName, t.LastUpdate, t.CreatedDate })
                    .ToList();
                    
                foreach (var member in listMembers)
                {
                    Console.WriteLine($"Email: {member.Email}");
                    Console.WriteLine($"List ID: {member.ListId}");
                    Console.WriteLine($"Full Name: {member.FullName}");
                    Console.WriteLine($"Last Update: {member.LastUpdate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "N/A"}");
                    Console.WriteLine($"Created Date: {member.CreatedDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "N/A"}");
                    Console.WriteLine(new string('-', 20));
                }
            }
        }
        
        static void Main(string[] args)
        {
            try
            {
                DisplayListMembers();
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occurred: " + ex.Message);
            }
        }
    }
}
PM> Install-Package Devart.Data.MailChimp
using System;
using System.Data;
using Devart.Data.MailChimp;

namespace MailChimpConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string connectionString = "Authentication Type=OAuthInteractive;License key=**********";

            try
            {
                using (MailChimpConnection connection = new MailChimpConnection(connectionString))
                {
                    connection.Open();
                    Console.WriteLine("Connection successful.");

                    // Insert new list member
                    string insertSql = "INSERT INTO ListMembers (Email, ListId) VALUES ('[email protected]', '**********')";

                    using (MailChimpCommand insertCommand = new MailChimpCommand(insertSql, connection))
                    {
                        int rowsAffected = insertCommand.ExecuteNonQuery();
                        Console.WriteLine($"Insert successful. Rows affected: {rowsAffected}");
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occurred: " + ex.Message);
            }
        }
    }
}
PM> Install-Package Devart.Data.MailChimp
using System;
using System.Data;
using Devart.Data.MailChimp;

namespace MailChimpConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string connectionString = "Authentication Type=OAuthInteractive;License key=**********";

            try
            {
                using (MailChimpConnection connection = new MailChimpConnection(connectionString))
                {
                    connection.Open();
                    Console.WriteLine("Connection successful.");

                    // Insert new list member
                    string insertSql = "INSERT INTO ListMembers (Email, ListId) VALUES (:Email, :ListId)";

                    using (MailChimpCommand insertCommand = new MailChimpCommand(insertSql, connection))
                    {
                        insertCommand.Parameters.Add("Email", DbType.String).Value = "[email protected]";
                        insertCommand.Parameters.Add("ListId", DbType.String).Value = "**********";

                        int rowsAffected = insertCommand.ExecuteNonQuery();
                        Console.WriteLine($"Insert successful. Rows affected: {rowsAffected}");
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occurred: " + ex.Message);
            }
        }
    }
}
PM> Install-Package Devart.Data.MailChimp
using System;
using System.Data;
using System.Threading.Tasks;
using Devart.Data.MailChimp;

namespace MailChimpConsoleApp
{
    class Program
    {
        static async Task Main(string[] args)
        {
            string connectionString = "Authentication Type=OAuthInteractive;License key=**********";

            try
            {
                using (MailChimpConnection connection = new MailChimpConnection(connectionString))
                {
                    await connection.OpenAsync();
                    Console.WriteLine("Connection successful.");

                    // Delete old list member
                    string deleteSql = "DELETE FROM ListMembers WHERE Email = :Email AND ListId = :ListId";

                    using (MailChimpCommand deleteCommand = new MailChimpCommand(deleteSql, connection))
                    {
                        deleteCommand.Parameters.Add("Email", DbType.String).Value = "[email protected]";
                        deleteCommand.Parameters.Add("ListId", DbType.String).Value = "4f5fcf51e0";

                        int rowsDeleted = await deleteCommand.ExecuteNonQueryAsync();
                        Console.WriteLine($"Delete successful. Rows affected: {rowsDeleted}");
                    }

                    // Insert new list member
                    string insertSql = "INSERT INTO ListMembers (Email, ListId) VALUES (:Email, :ListId)";

                    using (MailChimpCommand insertCommand = new MailChimpCommand(insertSql, connection))
                    {
                        insertCommand.Parameters.Add("Email", DbType.String).Value = "[email protected]";
                        insertCommand.Parameters.Add("ListId", DbType.String).Value = "4f5fcf51e0";

                        int rowsInserted = await insertCommand.ExecuteNonQueryAsync();
                        Console.WriteLine($"Insert successful. Rows affected: {rowsInserted}");
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occurred: " + ex.Message);
            }
        }
    }
}
PM> Install-Package Devart.Data.MailChimp

Documentation

Licensing
Licensing
A detailed technical reference on embedding license information—a required resource for applications built with dotConnect for MailChimp.
DataAdapter features
DataTable features
A guide to using the MailChimpDataAdapter class for interacting with MailChimp 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
Since remote execution is significantly faster than client-side processing, using translatable SQL ensures optimal query performance.

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 MailChimp?
dotConnect for MailChimp 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 keep using the product.
Why do I need to install the product if NuGet is available?

dotConnect for MailChimp 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?

The method for applying your license depends on your project type:

  • For .NET (.NET Core/.NET 5+) projects, apply the License Key at runtime using the License Key connection string parameter.
  • For .NET Framework projects: no license key is needed. Simply download and install the licensed version of dotConnect from your Devart Customer Portal.
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.MailChimp.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. Just make sure they are only used by your solution.

There's no need for a full installation on the target machine, you can also 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:

  • Open Settings > Apps > Installed apps in Windows
  • Uninstall the current and any older versions of dotConnect, including Entity Developer and LinqConnect, if installed.
  • Visit the Customer Portal and download the latest licensed version.
  • 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 MailChimp
Go with the advanced edition of dotConnect for MailChimp and stay at the top of your game from day one!