Show / Hide Table of Contents

    OdbcDataContext.OdbcDataContext(IDataContextOptions dataContextOptions) Constructor

    .NET Standard 2.x

    Initializes a new instance of the OdbcDataContext class by passing the OdbcDataContextOptions type object as a parameter.

    Namespace: SnapObjects.Data.Odbc

    Assembly: SnapObjects.Data.Odbc.dll

    Syntax

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

    using Appeon.ApiDoc.Models;
    using Odbc.ManagedDataAccess.Client;
    using SnapObjects.Data;
    using SnapObjects.Data.Odbc;
    using System;
    
    namespace Appeon.ApiDoc.OdbcDataContextExamples
    {
        public class OdbcDataContextExample
        {
            public void Example1()
            {
                var dataContext = new OdbcDataContext(new OdbcDataContextOptions(CONNECTION_STRING));
    
                Console.WriteLine(dataContext.ContextOptions.DatabaseType);
    
                /*This code produces the following output:
    
                Odbc
                */
            }
        }
    }
    

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon