OdbcDataContextOptions<TAdoDbContext>.OdbcDataContextOptions(string connectionString) Constructor
.NET Standard 2.x
Initializes a new instance of the OdbcDataContextOptions<TAdoDbContext> class by passing the connection string as a parameter.
Namespace: SnapObjects.Data.Odbc
Assembly: SnapObjects.Data.Odbc.dll
Syntax
public OdbcDataContextOptions(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 OdbcDataContextOptions<OdbcContext>
class.
using Appeon.ApiDoc.Models;
using SnapObjects.Data;
using SnapObjects.Data.Odbc;
using System;
namespace Appeon.ApiDoc.OdbcDataContextOptions_GenericExamples
{
public class OdbcDataContextOptions_GenericExample
{
public void Example()
{
var options = new OdbcDataContextOptions<OdbcContext>(CONNECTION_STRING);
var dataContext = new OdbcDataContext(options);
Console.WriteLine(dataContext.ContextOptions.DatabaseType);
/*This code produces the following output:
Odbc
*/
}
}
}
Applies to
.NET Standard
2.x