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