Skip to content

Release v22.109.0

Choose a tag to compare

@github-actions github-actions released this 16 Oct 13:48
15d5376

Storage connections can now be resolved per tenant: which server, database and identity a MongoDB or Entity Framework Core connection uses, from configuration, a template, an HTTP endpoint or your own code. Nothing changes unless you configure it.

Added

  • Cratis.Arc.Connections: a connection resolution contract (IConnectionResolver, ConnectionRequest, ResolvedConnection, ConnectionIdentity, ConnectionPurpose). Every part of a resolved connection is optional, so a resolver can answer for the connection string, the database, the schema, the identity, or any combination. (#3314)
  • Built-in Default, Template, Http and Custom resolvers, with a Connection slot and an Identity slot that use the same shape and are applied in order. Resolutions are cached in memory per request, honor expiresAt, and are dropped when a login fails. (#3314)
  • ArcOptions.ConnectionResolution, configurable in code or under Cratis:Arc:ConnectionResolution, resolves connections for MongoDB and Entity Framework Core alike. An integration's own ConnectionResolution replaces it for that integration. (#3314)
  • ConnectionPurposeScope.Begin(ConnectionPurpose.Schema) so migrations can connect with a different identity than data access. (#3314)
  • MongoDBOptions.ConnectionResolution, configurable in code or under Cratis:MongoDB:ConnectionResolution. A resolved user name and password becomes a SCRAM credential, and a resolved access token becomes a MONGODB-OIDC credential that refreshes through the resolver. (#3315)
  • EntityFrameworkCoreOptions.ConnectionResolution. Arc-registered contexts resolve the connection for the current tenant and purpose every time it opens, so pooled contexts stay correct across tenants. Access tokens become SqlConnection.AccessToken on SQL Server and the password on PostgreSQL. (#3316)
  • A language-neutral REST specification, with an OpenAPI description, of the endpoint the Http resolver calls: https://github.com/Cratis/Arc/blob/main/Documentation/connection-resolution-contract.md (part of #3317)
  • Documentation for connection resolution, with how-to pages for MongoDB and Entity Framework Core: https://github.com/Cratis/Arc/blob/main/Documentation/backend/csharp/tenancy/connection-resolution.md (#3317) (#3313)

Changed

  • EntityFrameworkCoreOptions (ConnectionString, AutoDiscoverDbContexts, ConnectionResolution) now bind from the Cratis:EntityFrameworkCore configuration section. The configureOptions callback runs afterwards and wins. (part of #3316)

Fixed

  • MongoDB clients created through IMongoDBClientFactory are no longer shared between different credentials on the same server. (part of #3315)
  • The scoped IMongoClient and IMongoDatabase no longer capture the client factory in static fields, which leaked state across hosts. (part of #3315)