Show / Hide Table of Contents

    IDataContextOptions Interface

    .NET Standard 2.x

    Represents the options for the DataContext object.

    Namespace: SnapObjects.Data

    Assembly: SnapObjects.Data.dll

    Syntax

       public interface IDataContextOptions;
    

    Property

    Name Returns Type Description
    BatchExecuting bool Gets or sets a bool value, which indicates whether to execute SQL commands in bulk when saving changes.
    CommandTimeout DatabaseType Gets or sets the wait time before terminating the attempt to execute a command and generating an error.
    ConnectionString string Gets or sets a string that contains the connection information for opening the database.
    DatabaseType IsolationLevel Gets the database type.
    IsolationLevel int Gets or sets the default isolation level of the transaction in the DataContext object.

    Examples

    The following code example demonstrates how to get the database type information by the IDataContextOptions object.

    using SnapObjects.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataContextOptionsExamples
    {
        public class IDataContextOptionsExample
        {
            private readonly SchoolContext _context;
            public IDataContextOptionsExample(SchoolContext context)
            {
                _context = context;
            }
    
            public void Example()
            {
                IDataContextOptions options;
                options = _context.ContextOptions;
    
                // Displays the database type for the current data context.
                Console.WriteLine("Database Type = {0}", options.DatabaseType);
    
                /* This code example produces the following output:
                
                Database Type = SqlServer
                */
    
            }
        }
    }
    
    Back to top Generated by Appeon