MySqlDataContextOptions<TAdoDbContext>.MySqlDataContextOptions(string connectionString) Constructor
.NET Standard 2.x
Initializes a new instance of the MySqlDataContextOptions<TAdoDbContext> class by passing the connection string as a parameter.
Namespace: SnapObjects.Data.MySql
Assembly: SnapObjects.Data.MySql.dll
Syntax
public MySqlDataContextOptions(string connectionString) : base(connectionString)
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<MySqlContext>
class.
using Appeon.ApiDoc.Models;
using SnapObjects.Data;
using SnapObjects.Data.MySql;
using System;
namespace Appeon.ApiDoc.MySqlDataContextOptions_GenericExamples
{
public class MySqlDataContextOptions_GenericExample
{
public void Example()
{
var options = new MySqlDataContextOptions<MySqlContext>(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