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