RepoDb.MySql 1.16.0-beta2

MySqlBuild MySqlHome MySqlVersion

RepoDb.MySql — RepoDB for MySQL (MySql.Data)

The MySQL provider for RepoDB — a fast, lightweight .NET ORM that lets you use raw SQL and fluent operations side by side on the same connection. Built on top of RepoDb and MySql.Data.

Important Pages

  • GitHub Home — core library and source code.
  • Website — full documentation, API reference, and blog.

Community

Dependencies

License

Apache-2.0 — Copyright © 2019 Michael Camara Pendon


Installation

Install-Package RepoDb.MySql

Or visit the installation page for more options.

Get Started

Initialize the bootstrapper once at application startup:

GlobalConfiguration
    .Setup()
    .UseMySql();

Then use any RepoDB operation directly on your MySqlConnection:

Query

using (var connection = new MySqlConnection(ConnectionString))
{
	var customer = connection.Query<Customer>(c => c.Id == 10045);
}

Insert

var customer = new Customer
{
	FirstName = "John",
	LastName = "Doe",
	IsActive = true
};
using (var connection = new MySqlConnection(ConnectionString))
{
	var id = connection.Insert<Customer>(customer);
}

Update

using (var connection = new MySqlConnection(ConnectionString))
{
	var customer = connection.Query<Customer>(10045);
	customer.FirstName = "John";
	customer.LastUpdatedUtc = DateTime.UtcNow;
	var affectedRows = connection.Update<Customer>(customer);
}

Delete

using (var connection = new MySqlConnection(ConnectionString))
{
	var customer = connection.Query<Customer>(10045);
	var deletedCount = connection.Delete<Customer>(customer);
}

ExecuteQuery

using (var connection = new MySqlConnection(ConnectionString))
{
	var customer = connection.ExecuteQuery<Customer>("SELECT * FROM `Customer` WHERE (Id = @Id);", new { Id = 10045 }).FirstOrDefault();
}

ExecuteNonQuery

using (var connection = new MySqlConnection(ConnectionString))
{
	var affectedRows = connection.ExecuteNonQuery("UPDATE `Customer` SET FirstName = @FirstName WHERE (Id = @Id);", new { FirstName = "John", Id = 10045 });
}

ExecuteScalar

using (var connection = new MySqlConnection(ConnectionString))
{
	var count = connection.ExecuteScalar<int>("SELECT COUNT(*) FROM `Customer`;");
}

Visit the get-started page for the full MySQL guide.

License

Apache License 2.0 — Copyright © 2019 Michael Camara Pendon

This project depends on Oracle's MySQL Connector/NET (MySql.Data), which is separately licensed under GPL-2.0 with the Universal FOSS Exception, Version 1.0.

No packages depend on RepoDb.MySql.

.NET 10.0

.NET 8.0

.NET 9.0

.NET Standard 2.0

Version Downloads Last updated
1.17.0 0 10/23/2026
1.17.0-alpha3 0 10/10/2026
1.17.0-alpha2 0 10/09/2026
1.17.0-alpha1 0 10/02/2026
1.16.0 0 09/09/2026
1.16.0-beta2 1 09/13/2026
1.16.0-beta1 0 08/15/2026
1.16.0-alpha1 1 09/13/2026
1.15.0 0 07/18/2026
1.15.0-telemetry 0 07/18/2026
1.14.0 0 06/28/2026
1.13.2-alpha1 0 02/26/2024
1.13.1 0 03/16/2023
1.13.0 0 11/02/2022
1.13.0-beta1 0 10/25/2022
1.13.0-alpha2 0 10/06/2022
1.13.0-alpha1 0 09/17/2022
1.3.2-alpha1 0 02/26/2024
1.1.6 0 02/18/2022
1.1.5 0 09/23/2021
1.1.5-beta1 0 09/17/2021
1.1.4 0 02/06/2021
1.1.3 0 12/30/2020
1.1.2 0 10/04/2020
1.1.1 0 10/03/2020
1.1.0 0 09/24/2020
1.1.0-beta2 0 09/17/2020
1.1.0-beta1 0 08/28/2020
1.0.15 0 08/02/2020
1.0.14 0 07/20/2020
1.0.13 0 07/11/2020
1.0.12 0 06/06/2020
1.0.11 0 05/23/2020
1.0.10 0 05/21/2020
1.0.10-beta1 0 05/10/2020
1.0.9 0 04/08/2020
1.0.8 0 04/08/2020
1.0.7 0 03/01/2020
1.0.6 0 02/16/2020
1.0.5 0 02/06/2020
1.0.4 0 02/01/2020
1.0.3 0 01/19/2020
1.0.3-beta1 0 01/04/2020
1.0.2 0 12/21/2019
1.0.1 0 12/18/2019
1.0.1-alpha1 0 12/17/2019
1.0.0 0 11/30/2019