Show / Hide Table of Contents

    SqliteDataContext.SqliteDataContext(SqliteConnection dbConnection) Constructor

    .NET Standard 2.x

    Initializes a new instance of the SqliteDataContext class by passing the SqliteConnection type object as a parameter.

    Namespace: SnapObjects.Data.Sqlite

    Assembly: SnapObjects.Data.Sqlite.dll

    Syntax

    public SqliteDataContext(SqliteConnection dbConnection) : base(dbConnection, new SqliteDataContextOptions(String.Empty))
    

    Parameters

    dbConnection SqliteConnection

    The connection object which is an SqliteConnection instance.

    Examples

    The following code example uses a SqliteConnection object to initialize an instance of the SqliteDataContext class.

    using Appeon.ApiDoc.Models;
    using Sqlite.ManagedDataAccess.Client;
    using SnapObjects.Data;
    using SnapObjects.Data.Sqlite;
    using System;
    
    namespace Appeon.ApiDoc.SqliteDataContextExamples
    {
        public class SqliteDataContextExample
        {
            public void Example2()
            {
                DataContext dataContext = new SqliteDataContext(new SqliteConnection(CONNECTION_STRING));
    
                Console.WriteLine(dataContext.ContextOptions.DatabaseType);
    
                /*This code produces the following output:
    
                Sqlite
                */
            }
        }
    }
    

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon