Skip to main content

ProfileConnectionSource

  • Namespace: PPDS.Auth.Pooling
  • Assembly: PPDS.Auth
  • Kind: Class
  • Implements: IDisposable

Summary​

Connection source that creates ServiceClients from an authentication profile. Implements IConnectionSource pattern for use with connection pools.

Members​

Constructors​

ProfileConnectionSource(AuthProfile profile, string environmentUrl, int maxPoolSize, Action<DeviceCodeInfo> deviceCodeCallback, Func<Action<DeviceCodeInfo>, PreAuthDialogResult> beforeInteractiveAuth, string environmentDisplayName, ISecureCredentialStore credentialStore, string clientSecretOverride, Action<AuthProfile> onProfileUpdated)​

ProfileConnectionSource(AuthProfile profile, string environmentUrl, int maxPoolSize, Action<DeviceCodeInfo> deviceCodeCallback, Func<Action<DeviceCodeInfo>, PreAuthDialogResult> beforeInteractiveAuth, string environmentDisplayName, ISecureCredentialStore credentialStore, string clientSecretOverride, Action<AuthProfile> onProfileUpdated)

Creates a new ProfileConnectionSource.

  • Param profile: The authentication profile.

  • Param environmentUrl: The Dataverse environment URL.

  • Param maxPoolSize: Maximum pool size (default: 52 per Microsoft recommendations).

  • Param deviceCodeCallback: Optional callback for device code display.

  • Param beforeInteractiveAuth: Optional callback invoked before browser opens for interactive auth. Returns the user's choice (OpenBrowser, UseDeviceCode, or Cancel).

  • Param environmentDisplayName: Optional environment display name for connection naming.

  • Param credentialStore: Optional secure credential store for looking up secrets.

  • Param clientSecretOverride: Optional client secret override (bypasses env var and store lookups).

  • Param onProfileUpdated: Optional callback invoked when profile metadata is updated (e.g., HomeAccountId after auth).

Methods​

Dispose​

void Dispose()

(inherited from System.IDisposable.Dispose)

FromProfile​

ProfileConnectionSource FromProfile(AuthProfile profile, int maxPoolSize, Action<DeviceCodeInfo> deviceCodeCallback, Func<Action<DeviceCodeInfo>, PreAuthDialogResult> beforeInteractiveAuth, ISecureCredentialStore credentialStore, Action<AuthProfile> onProfileUpdated)

Creates a ProfileConnectionSource from a profile, using the profile's environment.

  • Param profile: The authentication profile (must have environment set).

  • Param maxPoolSize: Maximum pool size.

  • Param deviceCodeCallback: Optional callback for device code display.

  • Param beforeInteractiveAuth: Optional callback invoked before browser opens for interactive auth. Returns the user's choice (OpenBrowser, UseDeviceCode, or Cancel).

  • Param credentialStore: Optional secure credential store for looking up secrets.

  • Param onProfileUpdated: Optional callback invoked when profile metadata is updated (e.g., HomeAccountId after auth).

  • Returns: A new connection source.

GetSeedClient​

ServiceClient GetSeedClient()

Gets the seed ServiceClient for cloning.

  • Returns: An authenticated, ready-to-use ServiceClient.

InvalidateSeed​

void InvalidateSeed()

Invalidates the cached seed client, forcing fresh authentication on next use.

Properties​

EnvironmentUrl​

string EnvironmentUrl { get; }

Gets the environment URL.

MaxPoolSize​

int MaxPoolSize { get; }

Gets the maximum number of pooled connections for this source.

Name​

string Name { get; }

Gets the unique name for this connection source. Includes identity and environment display name when available.

Profile​

AuthProfile Profile { get; }

Gets the authentication profile.