Show / Hide Table of Contents

    PostgreSqlDataContext.PostgreSqlDataContext(IDataContextOptions dataContextOptions) Constructor

    .NET Standard 2.x

    Initializes a new instance of the PostgreSqlDataContext class by passing the PostgreSqlDataContextOptions type object as a parameter.

    Namespace: SnapObjects.Data.PostgreSql

    Assembly: SnapObjects.Data.PostgreSql.dll

    Syntax

    public PostgreSqlDataContext(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 PostgreSqlDataContextOptions object to initialize an instance of the PostgreSqlDataContext class.

    using Appeon.ApiDoc.Models;
    using PostgreSql.ManagedDataAccess.Client;
    using SnapObjects.Data;
    using SnapObjects.Data.PostgreSql;
    using System;
    
    namespace Appeon.ApiDoc.PostgreSqlDataContextExamples
    {
        public class PostgreSqlDataContextExample
        {
            public void Example1()
            {
                var dataContext = new PostgreSqlDataContext(new PostgreSqlDataContextOptions(CONNECTION_STRING));
    
                Console.WriteLine(dataContext.ContextOptions.DatabaseType);
    
                /*This code produces the following output:
    
                PostgreSql
                */
            }
        }
    }
    

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon