### Example Usage Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBulkCopyColumnMappingType.md Examples demonstrating how to create and configure MySqlBulkCopyColumnMapping objects. ```APIDOC ## Example Usage ### Description Provides examples of how to instantiate and configure `MySqlBulkCopyColumnMapping` objects for different mapping scenarios. ### Code Examples ```csharp // Map source column at index 2 to destination column 'user_name' new MySqlBulkCopyColumnMapping { SourceOrdinal = 2, DestinationColumn = "user_name", }, // Map source column at index 0 to a user-defined variable '@tmp' and use an expression new MySqlBulkCopyColumnMapping { SourceOrdinal = 0, DestinationColumn = "@tmp", Expression = "column_value = @tmp * 2", } ``` ``` -------------------------------- ### Install NuGet Packages Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/tutorials/dapper.md Install the MySqlConnector and Dapper NuGet packages using the .NET CLI. ```bash dotnet add package MySqlConnector dotnet add package Dapper ``` -------------------------------- ### Run Telemetry Setup and Verification Scripts Source: https://github.com/mysql-net/mysqlconnector/blob/master/tests/Telemetry/README.md Execute the setup script to enable the Aspire telemetry API and the verification script to test trace generation and retrieval. ```powershell .\tests\Telemetry\setup.ps1 .\tests\Telemetry\verify.ps1 ``` -------------------------------- ### Install MySql.Data NuGet Package Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/troubleshooting/failed-add-reference-comerr.md This command attempts to install the MySql.Data NuGet package. It may fail with a 'Failed to add reference to comerr64' error. ```powershell Install-Package MySql.Data ``` -------------------------------- ### Create MySqlBulkCopyColumnMapping Instances Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBulkCopyColumnMappingType.md Demonstrates how to create instances of MySqlBulkCopyColumnMapping to map source columns to destination columns. The first example maps a source column by its ordinal position to a destination column name. The second example maps a source column by its ordinal position to a user-defined variable and specifies an expression to transform the value. ```csharp new MySqlBulkCopyColumnMapping { SourceOrdinal = 2, DestinationColumn = "user_name", }, new MySqlBulkCopyColumnMapping { SourceOrdinal = 0, DestinationColumn = "@tmp", Expression = "column_value = @tmp * 2", } ``` -------------------------------- ### MySqlBulkLoader.Priority Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBulkLoader/Priority.md Gets or sets the priority to load with. Defaults to None. ```APIDOC ## MySqlBulkLoader.Priority Property A [`MySqlBulkLoaderPriority`](../../MySqlBulkLoaderPriorityType/) giving the priority to load with (default None). ```csharp public MySqlBulkLoaderPriority Priority { get; set; } ``` ``` -------------------------------- ### MySqlBulkLoader.LinePrefix Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBulkLoader/LinePrefix.md Gets or sets an optional prefix in each line that should be skipped when loading. ```APIDOC ## MySqlBulkLoader.LinePrefix Property ### Description (Optional) A prefix in each line that should be skipped when loading. ### Property Signature ```csharp public string? LinePrefix { get; set; } ``` ``` -------------------------------- ### Set up EF Migrations Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/tutorials/efcore.md Install EF Core tools and design package, then add an initial migration and update the database. ```bash dotnet tool install --global dotnet-ef dotnet add package Microsoft.EntityFrameworkCore.Design dotnet ef migrations add InitialCreate dotnet ef database update ``` -------------------------------- ### Basic Database Connection and Query Source: https://github.com/mysql-net/mysqlconnector/blob/master/src/MySqlConnector/docs/README.md Demonstrates how to establish a database connection, create a command with parameters, and read results asynchronously using MySqlConnector. ```csharp var builder = new MySqlConnectionStringBuilder { Server = "your-server", UserID = "database-user", Password = "P@ssw0rd!", Database = "database-name", }; // open a connection asynchronously await using var connection = new MySqlConnection(builder.ConnectionString); await connection.OpenAsync(); // create a DB command and set the SQL statement with parameters await using var command = connection.CreateCommand(); command.CommandText = @"SELECT * FROM orders WHERE order_id = @OrderId;"; command.Parameters.AddWithValue("@OrderId", orderId); // execute the command and read the results await using var reader = await command.ExecuteReaderAsync(); while (reader.Read()) { var id = reader.GetInt32("order_id"); var date = reader.GetDateTime("order_date"); // ... } ``` -------------------------------- ### Create and Query Blog Posts Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/tutorials/efcore.md Demonstrates creating new Author and Post entities, adding them to the context, saving changes to the database, and then querying posts with their associated authors using LINQ and Include. ```csharp // create new blog posts using (var context = new BlogDataContext()) { var john = new Author { Name = "John T. Author", Email = "john@example.com" }; context.Authors.Add(john); var jane = new Author { Name = "Jane Q. Hacker", Email = "jane@example.com" }; context.Authors.Add(jane); var post = new Post { Title = "Hello World", Content = "I wrote an app using EF Core!", Author = jane }; context.Posts.Add(post); post = new Post { Title = "How to use EF Core", Content = "It's pretty easy", Author = john }; context.Posts.Add(post); context.SaveChanges(); } // query the blog posts, using a join between the two tables using (var context = new BlogDataContext()) { var posts = context.Posts .Include(p => p.Author) .ToList(); foreach (var post in posts) { Console.WriteLine($"{post.Title} by {post.Author.Name}"); } } ``` -------------------------------- ### MySqlRowUpdatedEventArgs.Command Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlRowUpdatedEventArgs/Command.md Gets the `MySqlCommand` that was executed. ```APIDOC ## MySqlRowUpdatedEventArgs.Command Property ### Description Gets the `MySqlCommand` that was executed. ### Property Type `MySqlCommand?` ``` -------------------------------- ### Example Usage of MySqlBatch Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBatchType.md Demonstrates how to create and execute a batch of SQL commands using MySqlBatch. This includes INSERT statements and setting variables. ```csharp await using var connection = new MySqlConnection("...connection string..."); await connection.OpenAsync(); using var batch = new MySqlBatch(connection) { BatchCommands = { new MySqlBatchCommand("INSERT INTO departments(name) VALUES(@name);") { Parameters = { new MySqlParameter("@name", "Sales"), }, }, new MySqlBatchCommand("SET @dept_id = last_insert_id()") , new MySqlBatchCommand("INSERT INTO employees(name, department_id) VALUES(@name, @dept_id);") { Parameters = { new MySqlParameter("@name", "Jim Halpert"), }, }, new MySqlBatchCommand("INSERT INTO employees(name, department_id) VALUES(@name, @dept_id);") { Parameters = { new MySqlParameter("@name", "Dwight Schrute"), }, }, }, }; await batch.ExecuteNonQueryAsync(); ``` -------------------------------- ### MySqlParameter.ParameterName Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlParameter/ParameterName.md Gets or sets the name of the parameter. ```APIDOC ## MySqlParameter.ParameterName Property ### Description Gets or sets the name of the parameter. ### Syntax ```csharp public override string ParameterName { get; set; } ``` ``` -------------------------------- ### MySqlAttributeCollection.Count Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlAttributeCollection/Count.md Gets the number of attributes in the collection. ```APIDOC ## MySqlAttributeCollection.Count Property ### Description Returns the number of attributes in the collection. ### Signature ```csharp public int Count { get; } ``` ``` -------------------------------- ### IAuthenticationPlugin.Name Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector.Authentication/IAuthenticationPlugin/Name.md Gets the authentication plugin name. ```APIDOC ## IAuthenticationPlugin.Name Property ### Description Gets the authentication plugin name. ### Signature ```csharp public string Name { get; } ``` ``` -------------------------------- ### Migrate to New Logging API with LoggerFactory Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/diagnostics/logging.md Configure a LoggerFactory and connect it to your desired logging framework. This example shows how to set up console logging, log4net, NLog, or Serilog. ```csharp // create a LoggerFactory and configure it with the desired logging framework // use ONLY ONE of the "Add" methods below, depending on your logging framework var loggerFactory = LoggerFactory.Create(builder => { // if you just want console logging builder.AddConsole(); // connect to log4net via Microsoft.Extensions.Logging.Log4Net.AspNetCore builder.AddLog4Net(new Log4NetProviderOptions { UseWebOrAppConfig = true, // set this if you're storing your settings in Web.config instead of log4net.config ExternalConfigurationSetup = true, // set this instead if you're initializing log4net yourself // see other options at https://github.com/huorswords/Microsoft.Extensions.Logging.Log4Net.AspNetCore }); // connect to NLog via NLog.Extensions.Logging builder.AddNLog(); // connect to Serilog via Serilog.Extensions.Logging builder.AddSerilog(dispose: true); }); // now create a MySqlDataSource and configure it with the LoggerFactory await using var dataSource = new MySqlDataSourceBuilder(yourConnectionString) .UseLoggerFactory(loggerFactory) .Build(); // create all MySqlConnection objects via the MySqlDataSource, not directly // DON'T: await using var connection = new MySqlConnection(yourConnectionString); await using var connection = dataSource.CreateConnection(); // you can also create open connections await using var connection = await dataSource.OpenConnectionAsync(); ``` -------------------------------- ### MySqlTransaction.DbConnection Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlTransaction/DbConnection.md Gets the `MySqlConnection` that this transaction is associated with. ```APIDOC ## MySqlTransaction.DbConnection Property ### Description Gets the [`MySqlConnection`](../../MySqlConnectionType/) that this transaction is associated with. ### Signature ```csharp protected override DbConnection? DbConnection { get; } ``` ``` -------------------------------- ### MySqlBatchCommand() Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBatchCommand/MySqlBatchCommand.md Initializes a new instance of the MySqlBatchCommand class with default settings. This is the default constructor. ```APIDOC ## MySqlBatchCommand() ### Description The default constructor. ### Method public MySqlBatchCommand() ### Parameters None ### Request Example ```csharp var command = new MySqlBatchCommand(); ``` ### Response None ``` -------------------------------- ### Add Pomelo.EntityFrameworkCore.MySql NuGet Package Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/tutorials/efcore.md Install the necessary NuGet package for EF Core MySQL integration. ```bash dotnet new console -o EFCoreMySQL cd EFCoreMySQL dotnet add package Pomelo.EntityFrameworkCore.MySql ``` -------------------------------- ### MySqlTransaction.Connection Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlTransaction/Connection.md Gets the `MySqlConnection` that this transaction is associated with. ```APIDOC ## MySqlTransaction.Connection Property ### Description Gets the `MySqlConnection` that this transaction is associated with. ### Signature ```csharp public MySqlConnection? Connection { get; } ``` ``` -------------------------------- ### Establish SSH Connection and Port Forwarding Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/tutorials/connect-ssh.md Sets up an SSH client, authenticates using password or private key, and forwards a local port to a remote database server. Requires SSH.NET and MySqlConnector. Ensure SSH host, username, and either password or key file are provided. ```csharp public static (SshClient SshClient, uint Port) ConnectSsh(string sshHostName, string sshUserName, string sshPassword = null, string sshKeyFile = null, string sshPassPhrase = null, int sshPort = 22, string databaseServer = "localhost", int databasePort = 3306) { // check arguments if (string.IsNullOrEmpty(sshHostName)) throw new ArgumentException($"{nameof(sshHostName)} must be specified.", nameof(sshHostName)); if (string.IsNullOrEmpty(sshUserName)) throw new ArgumentException($"{nameof(sshUserName)} must be specified.", nameof(sshUserName)); if (string.IsNullOrEmpty(sshPassword) && string.IsNullOrEmpty(sshKeyFile)) throw new ArgumentException($"One of {nameof(sshPassword)} and {nameof(sshKeyFile)} must be specified."); if (string.IsNullOrEmpty(databaseServer)) throw new ArgumentException($"{nameof(databaseServer)} must be specified.", nameof(databaseServer)); // define the authentication methods to use (in order) var authenticationMethods = new List(); if (!string.IsNullOrEmpty(sshKeyFile)) { authenticationMethods.Add(new PrivateKeyAuthenticationMethod(sshUserName, new PrivateKeyFile(sshKeyFile, string.IsNullOrEmpty(sshPassPhrase) ? null : sshPassPhrase))); } if (!string.IsNullOrEmpty(sshPassword)) { authenticationMethods.Add(new PasswordAuthenticationMethod(sshUserName, sshPassword)); } // connect to the SSH server var sshClient = new SshClient(new ConnectionInfo(sshHostName, sshPort, sshUserName, authenticationMethods.ToArray())); sshClient.Connect(); // forward a local port to the database server and port, using the SSH server var forwardedPort = new ForwardedPortLocal("127.0.0.1", databaseServer, (uint) databasePort); sshClient.AddForwardedPort(forwardedPort); forwardedPort.Start(); return (sshClient, forwardedPort.BoundPort); } ``` -------------------------------- ### MySqlParameter.Precision Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlParameter/Precision.md Gets or sets the precision of the parameter. ```APIDOC ## MySqlParameter.Precision Property ### Description Gets or sets the precision of the parameter. ### Syntax ```csharp public override byte Precision { get; set; } ``` ``` -------------------------------- ### Build and Test MySQL Connector Source: https://github.com/mysql-net/mysqlconnector/blob/master/README.md Clone the repository and run these commands to build the project and execute unit tests. Integration tests require additional setup. ```bash dotnet restore dotnet test tests\MySqlConnector.Tests ``` -------------------------------- ### MySqlParameter.Value Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlParameter/Value.md Gets or sets the value of this parameter. ```APIDOC ## MySqlParameter.Value Property ### Description Gets or sets the value of this parameter. ### Signature ```csharp public override object? Value { get; set; } ``` ``` -------------------------------- ### Run MySQL Server with Docker Source: https://github.com/mysql-net/mysqlconnector/blob/master/tests/README.md Launches a MySQL server instance using Docker for integration testing. Ensure Docker is installed and running. ```bash docker run -d --rm --pull always --name mysqlconnector -e MYSQL_ROOT_PASSWORD=pass -p 3306:3306 --tmpfs /var/lib/mysql mysql:9.7 --max-allowed-packet=96M --character-set-server=utf8mb4 --disable-log-bin --local-infile=1 --max-connections=250 ``` ```bash docker exec mysqlconnector mysql -uroot -ppass -e "INSTALL COMPONENT 'file://component_query_attributes'; CREATE USER 'caching-sha2-user'@'%' IDENTIFIED WITH caching_sha2_password BY 'Cach!ng-Sh@2-Pa55'; GRANT ALL PRIVILEGES ON *.* TO 'caching-sha2-user'@'%';" ``` -------------------------------- ### MySqlBulkLoader.NumberOfLinesToSkip Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBulkLoader/NumberOfLinesToSkip.md Gets or sets the number of lines to skip at the beginning of the file. Defaults to 0. ```csharp public int NumberOfLinesToSkip { get; set; } ``` -------------------------------- ### MySqlGeometry.WKB Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlGeometry/WKB.md Gets the Well-known Binary serialization of this geometry. ```APIDOC ## MySqlGeometry.WKB Property ### Description Gets the Well-known Binary (WKB) serialization of this geometry. ### Signature ```csharp public ReadOnlySpan WKB { get; } ``` ### Remarks This property returns a read-only span of bytes representing the geometry in WKB format. ``` -------------------------------- ### MySqlBatchCommand(string? commandText) Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBatchCommand/MySqlBatchCommand.md Initializes a new instance of the MySqlBatchCommand class with the specified command text. ```APIDOC ## MySqlBatchCommand(string? commandText) ### Description Initializes a new instance of the MySqlBatchCommand class with the specified command text. ### Method public MySqlBatchCommand(string? commandText) ### Parameters * **commandText** (string?) - The SQL statement or commands to execute. ### Request Example ```csharp var command = new MySqlBatchCommand("SELECT * FROM users"); ``` ### Response None ``` -------------------------------- ### MySqlDataAdapter() Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlDataAdapter/MySqlDataAdapter.md Initializes a new instance of the MySqlDataAdapter class with default settings. ```APIDOC ## MySqlDataAdapter() ### Description The default constructor. ### Method public MySqlDataAdapter() ### Parameters None ``` -------------------------------- ### MySqlDbColumn.ProviderType Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlDbColumn/ProviderType.md Gets the MySQL data type of the column. ```APIDOC ## MySqlDbColumn.ProviderType Property ### Description Gets the MySQL data type of the column. ### Method get ### Endpoint N/A (Property) ### Parameters None ### Request Example None ### Response #### Success Response - **ProviderType** (MySqlDbType) - The MySQL data type of the column. ``` -------------------------------- ### MySqlDateTime.Day Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlDateTime/Day.md Gets or sets the day of the month. ```csharp public int Day { get; set; } ``` -------------------------------- ### MySqlBatchCommand Constructors Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBatchCommandType.md Provides constructors for initializing a MySqlBatchCommand object. ```APIDOC ## MySqlBatchCommand() ### Description The default constructor. ### Method Constructor ### Parameters None ## MySqlBatchCommand(params MySqlParameter[]) ### Description Initializes a new instance of the MySqlBatchCommand class with the specified parameters. ### Method Constructor ### Parameters - **parameters** (MySqlParameter[]) - An array of MySqlParameter objects to associate with the command. ``` -------------------------------- ### MySqlAttribute.Value Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlAttribute/Value.md Gets or sets the attribute value. ```APIDOC ## MySqlAttribute.Value Property ### Description Gets or sets the attribute value. ### Signature ```csharp public object? Value { get; set; } ``` ``` -------------------------------- ### Initialize MySqlBulkLoader with Connection Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBulkLoader/MySqlBulkLoader.md Use this constructor to create a new MySqlBulkLoader instance, providing the MySqlConnection to be used for bulk operations. Ensure a valid MySqlConnection is established before instantiation. ```csharp public MySqlBulkLoader(MySqlConnection connection) ``` -------------------------------- ### Create MySQL Schema and Table Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/tutorials/net-core-mvc.md Initializes the 'blog' schema and creates the 'BlogPost' table with an auto-incrementing ID, content, and title. ```sql CREATE SCHEMA blog; USE blog; CREATE TABLE IF NOT EXISTS `BlogPost` ( Id INT NOT NULL AUTO_INCREMENT, Content LONGTEXT CHARSET utf8mb4, Title LONGTEXT CHARSET utf8mb4, PRIMARY KEY (`Id`) ) ENGINE=InnoDB; ``` -------------------------------- ### MySqlAttribute.AttributeName Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlAttribute/AttributeName.md Gets or sets the attribute name. ```APIDOC ## MySqlAttribute.AttributeName Property ### Description Gets or sets the attribute name. ### Signature ```csharp public string AttributeName { get; set; } ``` ``` -------------------------------- ### MySqlParameter.SourceVersion Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlParameter/SourceVersion.md Gets or sets the version of the row to which the parameter is bound. ```APIDOC ## MySqlParameter.SourceVersion Property ### Description Gets or sets the version of the row to which the parameter is bound. ### Syntax ```csharp public override DataRowVersion SourceVersion { get; set; } ``` ``` -------------------------------- ### MySqlBatch.Prepare Method Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBatch/Prepare.md Prepares the `MySqlBatch` for execution. This method should be called before executing the batch to ensure all commands are properly formatted and ready. ```APIDOC ## MySqlBatch.Prepare Method ### Description Prepares the `MySqlBatch` for execution. This method should be called before executing the batch to ensure all commands are properly formatted and ready. ### Method Signature ```csharp public override void Prepare() ``` ### Parameters This method does not take any parameters. ### Returns This method does not return a value. ``` -------------------------------- ### MySqlParameter.SourceColumn Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlParameter/SourceColumn.md Gets or sets the name of the source column. ```APIDOC ## MySqlParameter.SourceColumn Property ### Description Gets or sets the name of the source column that contains the data to be loaded into the data column. ### Syntax ```csharp public override string SourceColumn { get; set; } ``` ``` -------------------------------- ### MySqlParameter.DbType Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlParameter/DbType.md Gets or sets the data type of the parameter. ```APIDOC ## MySqlParameter.DbType Property ### Description Gets or sets the data type of the parameter. ### Signature ```csharp public override DbType DbType { get; set; } ``` ``` -------------------------------- ### MySqlBatchCommand(string? commandText) Constructor Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBatchCommand/MySqlBatchCommand.md Initializes a new instance of the MySqlBatchCommand class with the specified command text. Use this to immediately set the SQL query. ```csharp public MySqlBatchCommand(string? commandText) ``` -------------------------------- ### MySqlEndOfStreamException.ExpectedByteCount Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlEndOfStreamException/ExpectedByteCount.md Gets the number of bytes that were expected to be read from the stream. ```APIDOC ## MySqlEndOfStreamException.ExpectedByteCount Property ### Description Gets the number of bytes that were expected to be read from the stream. ### Syntax ```csharp public int ExpectedByteCount { get; } ``` ``` -------------------------------- ### MySqlCommand Constructors Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlCommandType.md Initializes a new instance of the MySqlCommand class. ```APIDOC ## MySqlCommand() ### Description Initializes a new instance of the `MySqlCommand` class. ### Method Constructor ``` ```APIDOC ## MySqlCommand(string commandText) ### Description Initializes a new instance of the `MySqlCommand` class, setting `CommandText` to *commandText*. ### Method Constructor ``` -------------------------------- ### MySqlDataSource.ConnectionString Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlDataSource/ConnectionString.md Gets the connection string of the database represented by this MySqlDataSource. ```APIDOC ## MySqlDataSource.ConnectionString Property ### Description Gets the connection string of the database represented by this [`MySqlDataSource`](../../MySqlDataSourceType/). ### Signature ```csharp public override string ConnectionString { get; } ``` ``` -------------------------------- ### Generate Traces with Telemetry.cs Source: https://github.com/mysql-net/mysqlconnector/blob/master/tests/Telemetry/README.md Run the Telemetry.cs application to generate traces for MySqlConnector operations. This requires the setup script to have been executed previously. ```powershell dotnet .\tests\Telemetry\Telemetry.cs ``` -------------------------------- ### UserID Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlConnectionStringBuilderType.md Gets or sets the MySQL user ID. ```APIDOC ## UserID ### Description Gets or sets the MySQL user ID. ### Property UserID { get; set; } ``` -------------------------------- ### UserID Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlConnectionStringBuilder/UserID.md Gets or sets the MySQL user ID. ```APIDOC ## UserID Property ### Description Gets or sets the MySQL user ID. ### Syntax ```csharp public string UserID { get; set; } ``` ``` -------------------------------- ### Asynchronous Console Application Example Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/tutorials/best-practices.md Demonstrates how to leverage asynchronous operations for improved performance. Ensure all methods in the call stack that interact with MySqlConnector are async. ```csharp using System.Threading.Tasks; using System.Collections.Generic; namespace MySqlConnector.Examples; public class Program { public static async Task Main(string[] args) { var tasks = new List(); for (var i=0; i<100; i++) { tasks.Add(Controllers.SleepOne()); } // these 100 queries should all complete in around // 1 second if "Max Pool Size=100" (the default) await Task.WhenAll(tasks); } } public class Controllers { public static async Task SleepOne() { using var db = new AppDb(); await db.Connection.OpenAsync(); await using var cmd = db.Connection.CreateCommand(); cmd.CommandText = @"SELECT SLEEP(1)"; await cmd.ExecuteNonQueryAsync(); } } ``` -------------------------------- ### MySqlBulkCopy.DestinationTableName Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBulkCopyType.md Gets or sets the name of the table to insert rows into. ```APIDOC ## MySqlBulkCopy.DestinationTableName ### Description The name of the table to insert rows into. ### Property - **DestinationTableName** (string) - The name of the destination table. ``` -------------------------------- ### MySqlCommand(string? commandText, MySqlConnection? connection) Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlCommand/MySqlCommand.md Initializes a new instance of the MySqlCommand class with specified command text and connection. ```APIDOC ## MySqlCommand(string? commandText, MySqlConnection? connection) ### Description Initializes a new instance of the `MySqlCommand` class with the specified command text and [`MySqlConnection`](../../MySqlConnectionType/). ### Method `public MySqlCommand(string? commandText, MySqlConnection? connection)` ### Parameters #### Path Parameters - **commandText** (string?) - Required - The text to assign to [`CommandText`](../CommandText/). - **connection** (MySqlConnection?) - Required - The [`MySqlConnection`](../../MySqlConnectionType/) to use. ``` -------------------------------- ### Initialize MySqlCommand with Command Text and Connection Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlCommand/MySqlCommand.md Initializes a new instance of the MySqlCommand class with the specified command text and MySqlConnection. ```csharp public MySqlCommand(string? commandText, MySqlConnection? connection) ``` -------------------------------- ### MySqlCommand.Connection Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlCommand/Connection.md Gets or sets the MySqlConnection associated with this command. ```APIDOC ## MySqlCommand.Connection Property ### Description Gets or sets the `MySqlConnection` associated with this command. ### Signature ```csharp public MySqlConnection? Connection { get; set; } ``` ### Remarks This property is used to associate a `MySqlCommand` with a specific `MySqlConnection` to execute the command against. ### See Also * [MySqlConnection](../../MySqlConnectionType/) * [MySqlCommand](../../MySqlCommandType/) ``` -------------------------------- ### Install MySqlConnector NuGet Package Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/tutorials/connect-to-mysql.md Use the dotnet CLI to add the MySqlConnector package to your project. Alternatively, use the NuGet Package Manager GUI. ```txt dotnet add package MySqlConnector ``` -------------------------------- ### MySqlBatch.Connection Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBatch/Connection.md Gets or sets the MySqlConnection associated with this batch. ```APIDOC ## MySqlBatch.Connection Property ### Description Gets or sets the `MySqlConnection` associated with this batch. This property is nullable. ### Signature ```csharp public MySqlConnection? Connection { get; set; } ``` ### Type `MySqlConnection?` ### Remarks This property allows you to associate a specific database connection with the `MySqlBatch` object. If the connection is not set, it might be implicitly created or managed by the context in which the `MySqlBatch` is used. ``` -------------------------------- ### MySqlCommandBuilder() Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlCommandBuilder/MySqlCommandBuilder.md Initializes a new instance of the MySqlCommandBuilder class with default settings. This is the parameterless constructor. ```APIDOC ## MySqlCommandBuilder() ### Description The default constructor. ### Method Signature ```csharp public MySqlCommandBuilder() ``` ``` -------------------------------- ### MySqlAttributeCollection Indexer Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlAttributeCollection/Item.md Gets the attribute at the specified index from the MySqlAttributeCollection. ```APIDOC ## MySqlAttributeCollection Indexer ### Description Gets the attribute at the specified index. ### Method Signature ```csharp public MySqlAttribute this[int index] { get; } ``` ### Parameters #### Path Parameters - **index** (int) - Required - The index of the attribute to retrieve. ### Return Value The [`MySqlAttribute`](../../MySqlAttributeType/) at the specified index. ``` -------------------------------- ### MySqlBatch() Constructor Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBatch/MySqlBatch.md Initializes a new MySqlBatch object. The Connection property must be set before this object can be used. ```csharp public MySqlBatch() ``` -------------------------------- ### Get All Blog Posts Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/tutorials/net-core-mvc.md Retrieves a list of the latest blog posts. ```APIDOC ## GET /api/blog ### Description Retrieves a list of the latest blog posts. ### Method GET ### Endpoint /api/blog ### Response #### Success Response (200) - **List of BlogPost objects** - The latest blog posts. #### Response Example [Example response would be a JSON array of BlogPost objects] ``` -------------------------------- ### MySqlBatch() Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBatch/MySqlBatch.md Initializes a new MySqlBatch object. The Connection property must be set before this object can be used. ```APIDOC ## MySqlBatch() ### Description Initializes a new `MySqlBatch` object. The `Connection` property must be set before this object can be used. ### Method Constructor ### Parameters None ``` -------------------------------- ### MySqlDataAdapter Constructor with Command Text and Connection String Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlDataAdapter/MySqlDataAdapter.md Initializes a new instance of the MySqlDataAdapter class with the specified select command text and connection string. A new connection will be opened and closed automatically. ```csharp public MySqlDataAdapter(string selectCommandText, string connectionString) ``` -------------------------------- ### MySqlRowUpdatingEventArgs.Command Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlRowUpdatingEventArgsType.md Gets the SQL command to be executed for the row update. ```APIDOC ## MySqlRowUpdatingEventArgs.Command ### Description Gets the SQL command to be executed for the row update. ### Property `MySql.Data.MySqlClient.MySqlCommand Command { get; }` ``` -------------------------------- ### Command Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlRowUpdatedEventArgsType.md Gets the command associated with the row update operation. ```APIDOC ## Command ### Description Gets the command associated with the row update operation. ### Property Type MySqlCommand ### Access Read-only ``` -------------------------------- ### MySqlBulkLoader Class Overview Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBulkLoaderType.md Demonstrates how to initialize and configure MySqlBulkLoader to load data from a CSV file. ```APIDOC ## MySqlBulkLoader Class [`MySqlBulkLoader`](../MySqlBulkLoaderType/) lets you efficiently load a MySQL Server Table with data from a CSV or TSV file or Stream. ### Example Usage ```csharp await using var connection = new MySqlConnection("...;AllowLoadLocalInfile=True"); await connection.OpenAsync(); var bulkLoader = new MySqlBulkLoader(connection) { FileName = @"C:\Path\To\file.csv", TableName = "destination", CharacterSet = "UTF8", NumberOfLinesToSkip = 1, FieldTerminator = ",", FieldQuotationCharacter = '"', FieldQuotationOptional = true, Local = true, } var rowCount = await bulkLoader.LoadAsync(); ``` ### Public Members - **MySqlBulkLoader(MySqlConnection connection)**: Initializes a new instance of the [`MySqlBulkLoader`](../MySqlBulkLoaderType/) class with the specified [`MySqlConnection`](../MySqlConnectionType/). - **CharacterSet { get; set; }**: (Optional) The character set of the source data. By default, the database's character set is used. - **Columns { get; }**: (Optional) A list of the column names in the destination table that should be filled with data from the input file. - **ConflictOption { get; set; }**: A [`MySqlBulkLoaderConflictOption`](../MySqlBulkLoaderConflictOptionType/) value that specifies how conflicts are resolved (default None). - **Connection { get; set; }**: The [`MySqlConnection`](../MySqlConnectionType/) to use. - **EscapeCharacter { get; set; }**: (Optional) The character used to escape instances of [`FieldQuotationCharacter`](../MySqlBulkLoader/FieldQuotationCharacter/) within field values. - **Expressions { get; }**: (Optional) A list of expressions used to set field values from the columns in the source data. - **FieldQuotationCharacter { get; set; }**: (Optional) The character used to enclose fields in the source data. - **FieldQuotationOptional { get; set; }**: Whether quoting fields is optional (default `false`). - **FieldTerminator { get; set; }**: (Optional) The string fields are terminated with. - **FileName { get; set; }**: The name of the local (if [`Local`](../MySqlBulkLoader/Local/) is `true`) or remote (otherwise) file to load. Either this or [`SourceStream`](../MySqlBulkLoader/SourceStream/) must be set. - **LinePrefix { get; set; }**: (Optional) A prefix in each line that should be skipped when loading. - **LineTerminator { get; set; }**: (Optional) The string lines are terminated with. - **Local { get; set; }**: Whether a local file is being used (default `true`). - **NumberOfLinesToSkip { get; set; }**: The number of lines to skip at the beginning of the file (default `0`). - **Priority { get; set; }**: A [`MySqlBulkLoaderPriority`](../MySqlBulkLoaderPriorityType/) giving the priority to load with (default None). - **SourceStream { get; set; }**: A Stream containing the data to load. Either this or [`FileName`](../MySqlBulkLoader/FileName/) must be set. The [`Local`](../MySqlBulkLoader/Local/) property must be `true` if this is set. - **TableName { get; set; }**: The name of the table to load into. If this is a reserved word or contains spaces, it must be quoted. - **Timeout { get; set; }**: The timeout (in milliseconds) to use. - **Load()**: Loads all data in the source file or stream into the destination table. - **LoadAsync()**: Asynchronously loads all data in the source file or stream into the destination table. - **LoadAsync(CancellationToken cancellationToken)**: Asynchronously loads all data in the source file or stream into the destination table. ``` -------------------------------- ### MySqlDataAdapter Constructor with Command Text and Connection Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlDataAdapter/MySqlDataAdapter.md Initializes a new instance of the MySqlDataAdapter class with the specified select command text and a MySqlConnection object. The connection must be open. ```csharp public MySqlDataAdapter(string selectCommandText, MySqlConnection connection) ``` -------------------------------- ### MySqlParameter.Direction Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlParameter/Direction.md Gets or sets a value that indicates the direction of the parameter. ```APIDOC ## MySqlParameter.Direction Property ### Description Gets or sets a value that indicates the direction of the parameter. ### Signature ```csharp public override ParameterDirection Direction { get; set; } ``` ### See Also * class [MySqlParameter](../../MySqlParameterType/) * namespace [MySqlConnector](../../MySqlParameterType/) * assembly [MySqlConnector](../../../MySqlConnectorAssembly/) ``` -------------------------------- ### MySqlConnection() Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlConnection/MySqlConnection.md Initializes a new instance of the MySqlConnection class with default settings. This constructor does not take any arguments. ```APIDOC ## MySqlConnection() ### Description The default constructor for MySqlConnection. ### Method `public MySqlConnection()` ### Parameters None ``` -------------------------------- ### MySqlGeometry.SRID Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlGeometry/SRID.md Gets the Spatial Reference System ID of this geometry. ```APIDOC ## MySqlGeometry.SRID Property ### Description Gets the Spatial Reference System ID of this geometry. ### Syntax ```csharp public int SRID { get; } ``` ``` -------------------------------- ### MySqlDateTime.Year Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlDateTime/Year.md Gets or sets the year component of a MySqlDateTime value. ```APIDOC ## MySqlDateTime.Year Property ### Description Gets or sets the year. ### Signature ```csharp public int Year { get; set; } ``` ``` -------------------------------- ### MySqlBulkCopyColumnMapping() Constructor Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBulkCopyColumnMapping/MySqlBulkCopyColumnMapping.md Initializes a new instance of the MySqlBulkCopyColumnMapping class with default values. Use this when no specific column mapping is required initially. ```csharp public MySqlBulkCopyColumnMapping() ``` -------------------------------- ### MySqlDateTime.Year Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlDateTime/Year.md Gets or sets the year component of a MySqlDateTime value. ```csharp public int Year { get; set; } ``` -------------------------------- ### Remove Old Package and Add New Source: https://github.com/mysql-net/mysqlconnector/blob/master/src/MySqlConnector.DependencyInjection/docs/README.md Commands to uninstall the old MySqlConnector.DependencyInjection package and add the MySqlConnector package. ```bash dotnet remove package MySqlConnector.DependencyInjection dotnet add package MySqlConnector ``` -------------------------------- ### MySqlConnectorFactory.CreateCommand Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlConnectorFactory/CreateCommand.md Creates a new `MySqlCommand` object. ```APIDOC ## MySqlConnectorFactory.CreateCommand() ### Description Creates a new [`MySqlCommand`](../../MySqlCommandType/) object. ### Method Signature ```csharp public override DbCommand CreateCommand() ``` ``` -------------------------------- ### MySqlDateTime.Millisecond Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlDateTime/Millisecond.md Gets or sets the milliseconds component of a MySqlDateTime value. ```APIDOC ## MySqlDateTime.Millisecond Property ### Description Gets or sets the milliseconds. ### Signature ```csharp public int Millisecond { get; set; } ``` ``` -------------------------------- ### MySqlDateTime.Month Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlDateTime/Month.md Gets or sets the month component of a MySqlDateTime value. ```APIDOC ## MySqlDateTime.Month Property ### Description Gets or sets the month. ### Signature ```csharp public int Month { get; set; } ``` ``` -------------------------------- ### MySqlBatch(MySqlConnection? connection = null, MySqlTransaction? transaction = null) Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBatch/MySqlBatch.md Initializes a new MySqlBatch object, setting the Connection and Transaction if specified. ```APIDOC ## MySqlBatch(MySqlConnection? connection = null, MySqlTransaction? transaction = null) ### Description Initializes a new `MySqlBatch` object, setting the `Connection` and `Transaction` if specified. ### Method Constructor ### Parameters #### Path Parameters - **connection** (MySqlConnection? optional) - The `MySqlConnection` to use. - **transaction** (MySqlTransaction? optional) - The `MySqlTransaction` to use. ``` -------------------------------- ### MySqlBatchCommand() Constructor Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBatchCommand/MySqlBatchCommand.md Initializes a new instance of the MySqlBatchCommand class with default values. Use this when you will set the command text later. ```csharp public MySqlBatchCommand() ``` -------------------------------- ### MySqlDateTime.Minute Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlDateTime/Minute.md Gets or sets the minute component of a MySqlDateTime value. ```APIDOC ## MySqlDateTime.Minute Property ### Description Gets or sets the minute. ### Signature ```csharp public int Minute { get; set; } ``` ``` -------------------------------- ### MySqlDateTime.Day Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlDateTime/Day.md Gets or sets the day of the month for a MySqlDateTime value. ```APIDOC ## MySqlDateTime.Day Property ### Description Gets or sets the day of the month. ### Signature ```csharp public int Day { get; set; } ``` ``` -------------------------------- ### Initialize MySqlCommand Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlCommand/MySqlCommand.md Initializes a new instance of the MySqlCommand class without any parameters. ```csharp public MySqlCommand() ``` -------------------------------- ### MySqlConnectionStringBuilder.DateTimeKind Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlConnectionStringBuilder/DateTimeKind.md Gets or sets the DateTimeKind to use when deserializing DATETIME values. ```APIDOC ## MySqlConnectionStringBuilder.DateTimeKind Property ### Description Gets or sets the `DateTimeKind` to use when deserializing `DATETIME` values. ### Syntax ```csharp public MySqlDateTimeKind DateTimeKind { get; set; } ``` ### See Also * enum [MySqlDateTimeKind](../../MySqlDateTimeKindType/) * class [MySqlConnectionStringBuilder](../../MySqlConnectionStringBuilderType/) ``` -------------------------------- ### Initialize MySqlCommand with Command Text, Connection, and Transaction Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlCommand/MySqlCommand.md Initializes a new instance of the MySqlCommand class with the specified command text, MySqlConnection, and MySqlTransaction. ```csharp public MySqlCommand(string? commandText, MySqlConnection? connection, MySqlTransaction? transaction) ``` -------------------------------- ### Implement Blog Post API Endpoints Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/tutorials/net-core-mvc.md Add these methods to `Program.cs` to expose asynchronous CRUD operations for blog posts via Minimal API endpoints. Ensure `MySqlDataSource` and `BlogPostRepository` are configured. ```csharp // GET api/blog app.MapGet("/api/blog", async ([FromServices] MySqlDataSource db) => { var repository = new BlogPostRepository(db); return await repository.LatestPostsAsync(); }); // GET api/blog/5 app.MapGet("/api/blog/{id}", async ([FromServices] MySqlDataSource db, int id) => { var repository = new BlogPostRepository(db); var result = await repository.FindOneAsync(id); return result is null ? Results.NotFound() : Results.Ok(result); }); // POST api/blog app.MapPost("/api/blog", async ([FromServices] MySqlDataSource db, [FromBody] BlogPost body) => { var repository = new BlogPostRepository(db); await repository.InsertAsync(body); return body; }); // PUT api/blog/5 app.MapPut("/api/blog/{id}", async (int id, [FromServices] MySqlDataSource db, [FromBody] BlogPost body) => { var repository = new BlogPostRepository(db); var result = await repository.FindOneAsync(id); if (result is null) return Results.NotFound(); result.Title = body.Title; result.Content = body.Content; await repository.UpdateAsync(result); return Results.Ok(result); }); // DELETE api/blog/5 app.MapDelete("/api/blog/{id}", async ([FromServices] MySqlDataSource db, int id) => { var repository = new BlogPostRepository(db); var result = await repository.FindOneAsync(id); if (result is null) return Results.NotFound(); await repository.DeleteAsync(result); return Results.NoContent(); }); // DELETE api/blog app.MapDelete("/api/blog", async ([FromServices] MySqlDataSource db) => { var repository = new BlogPostRepository(db); await repository.DeleteAllAsync(); return Results.NoContent(); }); ``` -------------------------------- ### MySqlConnection.Database Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlConnection/Database.md Gets the name of the database that the connection is currently using. ```APIDOC ## MySqlConnection.Database Property ### Description Gets the name of the database that the connection is currently using. ### Signature ```csharp public override string Database { get; } ``` ``` -------------------------------- ### MySqlCommand() Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlCommand/MySqlCommand.md Initializes a new instance of the MySqlCommand class with default values. ```APIDOC ## MySqlCommand() ### Description Initializes a new instance of the `MySqlCommand` class. ### Method `public MySqlCommand()` ``` -------------------------------- ### MySqlConnection.DataSource Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlConnection/DataSource.md Gets the data source that the MySqlConnection object is connected to. ```APIDOC ## MySqlConnection.DataSource Property ### Description Gets the data source that the MySqlConnection object is connected to. ### Method get ### Endpoint N/A (Property) ### Parameters None ### Request Example None ### Response #### Success Response - **DataSource** (string) - The data source string. ``` -------------------------------- ### MySqlBulkCopy.ConflictOption Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBulkCopyType.md Gets or sets a MySqlBulkLoaderConflictOption value that specifies how conflicts are resolved. ```APIDOC ## MySqlBulkCopy.ConflictOption ### Description A [`MySqlBulkLoaderConflictOption`](../MySqlBulkLoaderConflictOptionType/) value that specifies how conflicts are resolved (default None). ### Property - **ConflictOption** (MySqlBulkLoaderConflictOption) - The conflict resolution option. ``` -------------------------------- ### MySqlBatchCommand Methods Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBatchCommandType.md Provides methods for creating parameters associated with the batch command. ```APIDOC ## CreateParameter() ### Description Creates a new instance of the parameter collection. ### Method Method ### Parameters None ### Returns A new instance of the parameter collection. ``` -------------------------------- ### MySqlAttribute Constructor (1 of 2) Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlAttribute/MySqlAttribute.md Initializes a new instance of the MySqlAttribute class with default values. ```APIDOC ## MySqlAttribute() ### Description Initializes a new instance of the `MySqlAttribute` class. ### Method Signature ```csharp public MySqlAttribute() ``` ``` -------------------------------- ### MySqlBulkLoader.FieldTerminator Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBulkLoader/FieldTerminator.md Gets or sets the string that fields are terminated with. This is an optional property. ```APIDOC ## MySqlBulkLoader.FieldTerminator Property ### Description (Optional) The string fields are terminated with. ### Signature ```csharp public string? FieldTerminator { get; set; } ``` ### See Also * class [MySqlBulkLoader](../../MySqlBulkLoaderType/) * namespace [MySqlConnector](../../MySqlBulkLoaderType/) * assembly [MySqlConnector](../../../MySqlConnectorAssembly/) ``` -------------------------------- ### MySqlDataAdapter(string selectCommandText, string connectionString) Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlDataAdapter/MySqlDataAdapter.md Initializes a new instance of the MySqlDataAdapter class with the specified SQL statement and connection string. ```APIDOC ## MySqlDataAdapter(string selectCommandText, string connectionString) ### Description Initializes a new instance of the MySqlDataAdapter class with the specified SQL statement and connection string. ### Method public MySqlDataAdapter(string selectCommandText, string connectionString) ### Parameters * **selectCommandText** (string) - The SQL statement to execute to retrieve records from the data source. * **connectionString** (string) - A string used to open the connection to the data source. ``` -------------------------------- ### CreateBatchCommand Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlConnectorFactory/CreateBatchCommand.md Creates a new `MySqlBatchCommand` object. ```APIDOC ## CreateBatchCommand() ### Description Creates a new [`MySqlBatchCommand`](../../MySqlBatchCommandType/) object. ### Method Signature ```csharp public override DbBatchCommand CreateBatchCommand() ``` ``` -------------------------------- ### MySqlBulkLoader.Connection Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBulkLoader/Connection.md Gets or sets the MySqlConnection to use for bulk loading. ```APIDOC ## MySqlBulkLoader.Connection Property ### Description Gets or sets the `MySqlConnection` to use for bulk loading operations. ### Property Type `MySqlConnection` ### Access Public get and set accessor. ``` -------------------------------- ### MySqlBatchCommandCollection.IsReadOnly Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBatchCommandCollection/IsReadOnly.md Gets a value indicating whether the collection is read-only. ```APIDOC ## MySqlBatchCommandCollection.IsReadOnly Property ### Description Gets a value indicating whether the collection is read-only. ### Property Value `true` if the collection is read-only; otherwise, `false`. ``` -------------------------------- ### Basic MySQL Connection String in C# Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/connection-options.md Demonstrates the simplest MySqlConnection string format for C# applications. Replace placeholders with your actual server, user ID, and password. ```csharp new MySqlConnection("Server=YOURSERVER;User ID=YOURUSERID;Password=YOURPASSWORD") ``` -------------------------------- ### MySqlBulkCopyColumnMapping() Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBulkCopyColumnMapping/MySqlBulkCopyColumnMapping.md Initializes a new instance of the MySqlBulkCopyColumnMapping class with default values. ```APIDOC ## MySqlBulkCopyColumnMapping() ### Description Initializes [`MySqlBulkCopyColumnMapping`](../../MySqlBulkCopyColumnMappingType/) with the default values. ### Method ```csharp public MySqlBulkCopyColumnMapping() ``` ``` -------------------------------- ### MySqlBatchCommand.CommandText Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBatchCommand/CommandText.md Gets or sets the SQL statement or commands to execute for the batch. ```APIDOC ## MySqlBatchCommand.CommandText Property ### Description Gets or sets the SQL statement or commands to execute for the batch. ### Syntax ```csharp public override string CommandText { get; set; } ``` ``` -------------------------------- ### MySqlBatchCommand.RecordsAffected Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlBatchCommand/RecordsAffected.md Gets the number of rows affected by the execution of the batch command. ```APIDOC ## MySqlBatchCommand.RecordsAffected Property ### Description Gets the number of rows affected by the execution of the batch command. ### Property Value An integer representing the number of rows affected. ``` -------------------------------- ### MySqlBatchCommand Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnectorNamespace.md Represents a command within a batch. ```APIDOC ## MySqlBatchCommand ### Description Represents a command within a batch. ### Type class ``` -------------------------------- ### MySqlParameterCollection.CopyTo Method Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlParameterCollection/CopyTo.md Copies the parameters to an array, starting at the specified index. ```APIDOC ## MySqlParameterCollection.CopyTo Method ### Description Copies the parameters to an array, starting at the specified index. ### Signature ```csharp public override void CopyTo(Array array, int index) ``` ### Parameters * **array** (Array) - The one-dimensional Array that is the destination of the elements copied from the collection. The Array must have zero-based indexing. * **index** (int) - The zero-based index in the array to which the first element of the collection is to be copied. ``` -------------------------------- ### MySqlCommand(string? commandText) Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlCommand/MySqlCommand.md Initializes a new instance of the MySqlCommand class, setting the CommandText property. ```APIDOC ## MySqlCommand(string? commandText) ### Description Initializes a new instance of the `MySqlCommand` class, setting [`CommandText`](../CommandText/) to *commandText*. ### Method `public MySqlCommand(string? commandText)` ### Parameters #### Path Parameters - **commandText** (string?) - Required - The text to assign to [`CommandText`](../CommandText/). ``` -------------------------------- ### MySqlParameterCollection.IsReadOnly Property Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlParameterCollection/IsReadOnly.md Gets a value indicating whether the MySqlParameterCollection has a fixed size. ```APIDOC ## MySqlParameterCollection.IsReadOnly Property ### Description Gets a value indicating whether the MySqlParameterCollection has a fixed size. ### Property Value `true` if the MySqlParameterCollection has a fixed size; otherwise, `false`. ``` -------------------------------- ### MySqlDataAdapter(MySqlCommand selectCommand) Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlDataAdapter/MySqlDataAdapter.md Initializes a new instance of the MySqlDataAdapter class with the specified SELECT statement. ```APIDOC ## MySqlDataAdapter(MySqlCommand selectCommand) ### Description Initializes a new instance of the MySqlDataAdapter class with the specified SELECT statement. ### Method public MySqlDataAdapter(MySqlCommand selectCommand) ### Parameters * **selectCommand** (MySqlCommand) - The SELECT statement to use for retrieving records from the data source. ``` -------------------------------- ### MySqlEndOfStreamException.ReadByteCount Source: https://github.com/mysql-net/mysqlconnector/blob/master/docs/content/api/MySqlConnector/MySqlEndOfStreamException/ReadByteCount.md Gets the number of bytes that were read when the end of the stream was reached unexpectedly. ```APIDOC ## MySqlEndOfStreamException.ReadByteCount Property ### Description Gets the number of bytes that were read when the end of the stream was reached unexpectedly. ### Property Value System.Int32 An `int` representing the number of bytes read. ```