Class SqlAddressRule
The SQL address rule: whether the run can provide a connection for the keys
AddressKeys declares, and the failure the accessors raise when it cannot.
The same predicate decides the Store capability at Build: a key counts as provided when it
has a configured value, or a registered infrastructure piece declares it and fills it when it
starts. A sibling access technology - Entity Framework Core, Dapper, raw ADO.NET - shares the rule:
read DeclaredKeys(IServiceCollection) while the host builds to gate its own Store capability, and use
IsInert(ProtoExecutionContext, SqlOptions) or ThrowIfInert(ProtoExecutionContext, SqlOptions) on the same keys at use time, so the capability
decision and the failure text cannot disagree with AddSql.
public static class SqlAddressRule
- Inheritance
-
SqlAddressRule
- Inherited Members
Methods
AnyProvided(ProtoExecutionContext, SqlAddressKeys)
Whether at least one declared key is provided for the running test.
public static bool AnyProvided(ProtoExecutionContext context, SqlAddressKeys keys)
Parameters
contextProtoExecutionContextkeysSqlAddressKeys
Returns
DeclaredKeys(IServiceCollection)
The keys the first successful AddSql declared, in declaration order, or an empty list
when it has not run yet. Read this when a sibling integration is registered - after
AddSql - to declare its Store capability over the same keys.
public static IReadOnlyList<string> DeclaredKeys(IServiceCollection services)
Parameters
servicesIServiceCollection
Returns
IsInert(ProtoExecutionContext, SqlOptions)
Whether the SQL integration is inert: address keys are declared and none is provided.
public static bool IsInert(ProtoExecutionContext context, SqlOptions options)
Parameters
contextProtoExecutionContextoptionsSqlOptions
Returns
ThrowIfInert(ProtoExecutionContext, SqlOptions)
Throws naming the missing keys and the capability gate when the integration is inert.
public static void ThrowIfInert(ProtoExecutionContext context, SqlOptions options)
Parameters
contextProtoExecutionContextoptionsSqlOptions