Show / Hide Table of Contents

    DataContext.ContextOptions Property

    .NET Standard 2.x

    Gets an IDataContextOptions object which contains options of the DataContext object.

    Namespace: SnapObjects.Data

    Assembly: SnapObjects.Data.dll

    Syntax

       public IDataContextOptions ContextOptions { get; }
    

    Property Value

    SnapObjects.Data.IDataContextOptions

    An IDataContextOptions object which contains options of the DataContext object.

    Examples

    The following code example demonstrates how to get the database type information from the DataContext object.

    using System;
    
    namespace Appeon.ApiDoc.DataContextExamples
    {
        public class ContextOptionsExample
        {
            private readonly SchoolContext _context;
    
            public ContextOptionsExample(SchoolContext context)
            {
                _context = context;
            }
    
            public void Example()
            {
                var options = _context.ContextOptions;
    
                // Shows the database type of the current DataContext
                Console.WriteLine("Database Type = {0}", options.DatabaseType);
    
                /* This code example produces the following output:
                
                Database Type = SqlServer
                */
            }
        }
    }
    

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon