# Class NpgsqlDataSourceManager

Namespace
  Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal

Assembly
  Npgsql.EntityFrameworkCore.PostgreSQL.dll

Manages resolving and creating NpgsqlDataSource instances.

    public class NpgsqlDataSourceManager : IDisposable, IAsyncDisposable

Inheritance
  object
  NpgsqlDataSourceManager

Implements
  IDisposable
  IAsyncDisposable

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

## Remarks

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

See Implementation of database providers and extensions for more information and examples.

## Constructors

### NpgsqlDataSourceManager(IEnumerable<INpgsqlDataSourceConfigurationPlugin>)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    public NpgsqlDataSourceManager(IEnumerable<INpgsqlDataSourceConfigurationPlugin> plugins)

#### Parameters

`plugins` IEnumerable<INpgsqlDataSourceConfigurationPlugin>

## Methods

### CreateDataSource(NpgsqlOptionsExtension)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    protected virtual NpgsqlDataSource CreateDataSource(NpgsqlOptionsExtension npgsqlOptionsExtension)

#### Parameters

`npgsqlOptionsExtension` NpgsqlOptionsExtension

#### Returns

NpgsqlDataSource

### Dispose()

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    public void Dispose()

### DisposeAsync()

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    public ValueTask DisposeAsync()

#### Returns

ValueTask

### GetDataSource(NpgsqlOptionsExtension?, IServiceProvider?)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

    public virtual DbDataSource? GetDataSource(NpgsqlOptionsExtension? npgsqlOptionsExtension, IServiceProvider? applicationServiceProvider)

#### Parameters

`npgsqlOptionsExtension` NpgsqlOptionsExtension
`applicationServiceProvider` IServiceProvider

#### Returns

DbDataSource