Search Results for

    Show / Hide Table of Contents

    Class NpgsqlDatabaseFacadeExtensions

    Npgsql specific extension methods for .

    Inheritance
    object
    NpgsqlDatabaseFacadeExtensions
    Namespace: Microsoft.EntityFrameworkCore
    Assembly: Npgsql.EntityFrameworkCore.PostgreSQL.dll
    Syntax
    public static class NpgsqlDatabaseFacadeExtensions

    Methods

    | Improve this Doc View Source

    IsNpgsql(DatabaseFacade)

    Returns true if the database provider currently in use is the Npgsql provider.

    This method can only be used after the has been configured because it is only then that the provider is known. This means that this method cannot be used in because this is where application code sets the provider to use as part of configuring the context.

    Declaration
    public static bool IsNpgsql(this DatabaseFacade database)
    Parameters
    Type Name Description
    DatabaseFacade database

    The facade from .

    Returns
    Type Description
    bool

    True if Npgsql is being used; false otherwise.

    | Improve this Doc View Source

    SetDbDataSource(DatabaseFacade, DbDataSource)

    Sets the underlying configured for this .

    Declaration
    public static void SetDbDataSource(this DatabaseFacade databaseFacade, DbDataSource dataSource)
    Parameters
    Type Name Description
    DatabaseFacade databaseFacade

    The for the context.

    DbDataSource dataSource

    The connection string.

    Remarks

    It may not be possible to change the data source if existing connection, if any, is open.

    See Connections and connection strings for more information and examples.

    • Improve this Doc
    • View Source
    In This Article
    Back to top © Copyright 2023 The Npgsql Development Team