MySqlDataContext.MySqlDataContext(IDataContextOptions dataContextOptions) Constructor
.NET Standard 2.x
Initializes a new instance of the MySqlDataContext class by passing the MySqlDataContextOptions type object as a parameter.
Namespace: SnapObjects.Data.MySql
Assembly: SnapObjects.Data.MySql.dll
Syntax
public MySqlDataContext(IDataContextOptions dataContextOptions) : base(dataContextOptions)
Parameters
dataContextOptions
SnapObjects.Data.IDataContextOptions
The options to be set for the DataContext
object.
Examples
The following code example uses the MySqlDataContextOptions
object to initialize an instance of the MySqlDataContext
class.
using Appeon.ApiDoc.Models;
using MySql.ManagedDataAccess.Client;
using SnapObjects.Data;
using SnapObjects.Data.MySql;
using System;
namespace Appeon.ApiDoc.MySqlDataContextExamples
{
public class MySqlDataContextExample
{
public void Example1()
{
var dataContext = new MySqlDataContext(new MySqlDataContextOptions(CONNECTION_STRING));
Console.WriteLine(dataContext.ContextOptions.DatabaseType);
/*This code produces the following output:
MySql
*/
}
}
}
Applies to
.NET Standard
2.x