OdbcSqlAnywhereDataContextOptions<TAdoDbContext>.OdbcSqlAnywhereDataContextOptions(string connectionString) Constructor
.NET Standard 2.x
Initializes a new instance of the OdbcSqlAnywhereDataContextOptions<TAdoDbContext> class by passing the connection string as a parameter.
Namespace: SnapObjects.Data.Odbc
Assembly: SnapObjects.Data.Odbc.dll
Syntax
public OdbcSqlAnywhereDataContextOptions(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 OdbcSqlAnywhereDataContextOptions<OdbcSqlAnywhereDataContext>
class.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using SnapObjects.Data.Odbc;
namespace Appeon.ApiDoc.OdbcSqlAnywhereDataContextOptions_GenericExamples
{
public class OdbcSqlAnywhereDataContextOptions_GenericExample
{
public void Example()
{
string asaConnectionString = "Dsn=SQL Anywhere 17 Demo;uid=dba;pwd=sql";
var options =
new OdbcSqlAnywhereDataContextOptions<OdbcSqlAnywhereDataContext>(
asaConnectionString);
var dataContext = new OdbcSqlAnywhereDataContext(options);
Console.WriteLine(dataContext.ContextOptions.DatabaseType);
/*This code produces the following output:
Odbc
*/
}
}
}
Applies to
.NET Standard
2.x