SqlCredential 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
SqlCredential提供了一种更安全的方法,用于使用 SQL Server 身份验证指定登录尝试的密码。
SqlCredential由用户 ID 和用于SQL Server身份验证的密码组成。 对象中的 SqlCredential 密码的类型 SecureString。
SqlCredential 无法继承。
Windows身份验证(Integrated Security = true)仍然是登录到SQL Server数据库的最安全方法。
public ref class SqlCredential sealed
public sealed class SqlCredential
type SqlCredential = class
Public NotInheritable Class SqlCredential
- 继承
-
SqlCredential
注解
Warning
Microsoft不建议直接提供用户名和密码,因为它是不安全模式。 如果可能,请对Azure资源使用更安全的身份验证流,例如 Managed Identities,或 Windows 身份验证 for SQL Server。
构造函数
| 名称 | 说明 |
|---|---|
| SqlCredential(String, SecureString) |
创建类型为 SqlCredential.. |
属性
| 名称 | 说明 |
|---|---|
| Password |
获取对象的密码组件 SqlCredential 。 |
| UserId |
获取对象的用户 ID 组件 SqlCredential 。 |
方法
| 名称 | 说明 |
|---|---|
| Equals(Object) |
确定指定的对象是否等于当前对象。 (继承自 Object) |
| GetHashCode() |
用作默认哈希函数。 (继承自 Object) |
| GetType() |
获取当前实例的 Type。 (继承自 Object) |
| MemberwiseClone() |
创建当前 Object的浅表副本。 (继承自 Object) |
| ToString() |
返回一个表示当前对象的字符串。 (继承自 Object) |