# Class NpgsqlDatabaseFacadeExtensions

Namespace
  Microsoft.EntityFrameworkCore

Assembly
  Npgsql.EntityFrameworkCore.PostgreSQL.dll

Npgsql specific extension methods for Database.

    public static class NpgsqlDatabaseFacadeExtensions

Inheritance
  object
  NpgsqlDatabaseFacadeExtensions

Inherited Members
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

## Methods

### IsNpgsql(DatabaseFacade)

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

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

    public static bool IsNpgsql(this DatabaseFacade database)

#### Parameters

`database` DatabaseFacade

  The facade from Database.

#### Returns

bool

  True if Npgsql is being used; false otherwise.

### SetDbDataSource(DatabaseFacade, DbDataSource)

Sets the underlying DbDataSource configured for this DbContext.

    public static void SetDbDataSource(this DatabaseFacade databaseFacade, DbDataSource dataSource)

#### Parameters

`databaseFacade` DatabaseFacade

  The DatabaseFacade for the context.

`dataSource` DbDataSource

  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.