Class SqlServerConnectionValidator
- Namespace
- ItTiger.TigerQuery.Core
- Assembly
- ItTiger.TigerQuery.Core.dll
Validates connection profiles against an explicit policy.
public static class SqlServerConnectionValidator
- Inheritance
-
SqlServerConnectionValidator
- Inherited Members
Methods
Validate(SqlServerConnectionProfile, SqlServerConnectionValidationPolicy)
Collects validation errors for a profile.
public static IReadOnlyList<string> Validate(SqlServerConnectionProfile profile, SqlServerConnectionValidationPolicy policy)
Parameters
profileSqlServerConnectionProfile- The profile to validate.
policySqlServerConnectionValidationPolicy- The required-field policy.
Returns
- IReadOnlyList<string>
- User-facing validation messages in name, server, then database order; an empty list indicates success.
Exceptions
- ArgumentNullException
profileorpolicyis null. The parameter name identifies the null argument.
ValidateComplete(SqlServerConnectionProfile, SqlServerConnectionValidationPolicy)
Collects validation errors for a profile including credential presence and
connection-string compatibility.
public static IReadOnlyList<string> ValidateComplete(SqlServerConnectionProfile profile, SqlServerConnectionValidationPolicy policy)
Parameters
profileSqlServerConnectionProfile- The profile to validate.
policySqlServerConnectionValidationPolicy- The required-field policy.
Returns
- IReadOnlyList<string>
- User-facing validation messages in required-field, credential, then connection-string order; an empty list indicates success.
Remarks
This is the validation applied by Copy(string, SqlServerConnectionCopyOptions, SqlServerConnectionValidationPolicy?) and reused by the connection commands, so a stored profile and a copied profile are held to the same standard.
SQL-password authentication is satisfied by either an in-memory PlainPassword or a persisted EncryptedPassword, so a profile whose protected password cannot be decrypted by the current user still validates. Connection-string compatibility is delegated to SqlConnectionStringBuilder rather than reimplemented, and no SQL connection is opened.
Exceptions
- ArgumentNullException
profileorpolicyis null. The parameter name identifies the null argument.