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 Return Type Description
    BatchExecuting bool Gets or sets a bool value, which indicates whether to execute SQL commands in bulk when saving changes.
    CommandTimeout int Gets or sets the wait time before terminating the attempt to execute a command and generating an error.
    ConnectionString string Gets a string that contains the connection information for opening the database.
    DatabaseType DatabaseType Gets the database type.
    DelimitIdentifier bool Specifies whether to enclose the names of tables, columns, indexes, and constraints in double quotes when the SQL statement is generated.
    IsolationLevel IsolationLevel Gets or sets the default isolation level of the transaction in the DataContext object.
    TrimSpaces bool Specifies whether to trim trailing spaces from a string.

    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