MySqlDataContextOptions.MySqlDataContextOptions(string connectionString) Constructor
.NET Standard 2.x
Initializes a new instance of the MySqlDataContextOptions class by passing the connection string as a parameter.
Namespace: SnapObjects.Data.MySql
Assembly: SnapObjects.Data.MySql.dll
Syntax
public MySqlDataContextOptions(string connectionString) : base(DatabaseType.MySql)
Parameters
connectionString
System.String
A string containing connection information about how to connect to the data source.
Examples
The following code example uses a connection string to initialize an instance of the MySqlDataContextOptions
class.
using Appeon.ApiDoc.Models;
using SnapObjects.Data;
using SnapObjects.Data.MySql;
using System;
namespace Appeon.ApiDoc.MySqlDataContextOptionsExamples
{
public class MySqlDataContextOptionsExample
{
public void Example()
{
var options = new MySqlDataContextOptions(CONNECTION_STRING);
var dataContext = new MySqlDataContext(options);
Console.WriteLine(dataContext.ContextOptions.DatabaseType);
/*This code produces the following output:
MySql
*/
}
}
}
Applies to
.NET Standard
2.x