ForeignKey 类
The ForeignKey object represents a SQL Server foreign key.
继承层次结构
System. . :: . .Object
Microsoft.SqlServer.Management.Smo. . :: . .SmoObjectBase
Microsoft.SqlServer.Management.Smo. . :: . .SqlSmoObject
Microsoft.SqlServer.Management.Smo. . :: . .NamedSmoObject
Microsoft.SqlServer.Management.Smo. . :: . .ScriptNameObjectBase
Microsoft.SqlServer.Management.Smo..::..ForeignKey
命名空间: Microsoft.SqlServer.Management.Smo
程序集: Microsoft.SqlServer.Smo(在 Microsoft.SqlServer.Smo.dll 中)
语法
声明
Public NotInheritable Class ForeignKey _
Inherits ScriptNameObjectBase _
Implements ICreatable, IDroppable, IMarkForDrop, IAlterable, _
IRenamable, IExtendedProperties, IScriptable, ISfcSupportsDesignMode
用法
Dim instance As ForeignKey
public sealed class ForeignKey : ScriptNameObjectBase,
ICreatable, IDroppable, IMarkForDrop, IAlterable, IRenamable,
IExtendedProperties, IScriptable, ISfcSupportsDesignMode
public ref class ForeignKey sealed : public ScriptNameObjectBase,
ICreatable, IDroppable, IMarkForDrop, IAlterable, IRenamable,
IExtendedProperties, IScriptable, ISfcSupportsDesignMode
[<SealedAttribute>]
type ForeignKey =
class
inherit ScriptNameObjectBase
interface ICreatable
interface IDroppable
interface IMarkForDrop
interface IAlterable
interface IRenamable
interface IExtendedProperties
interface IScriptable
interface ISfcSupportsDesignMode
end
public final class ForeignKey extends ScriptNameObjectBase implements ICreatable, IDroppable, IMarkForDrop, IAlterable, IRenamable, IExtendedProperties, IScriptable, ISfcSupportsDesignMode
ForeignKey 类型公开以下成员。
构造函数
名称 | 说明 | |
---|---|---|
ForeignKey() () () () | Initializes a new instance of the ForeignKey class. | |
ForeignKey(Table, String) | Initializes a new instance of the ForeignKey class on the specified table with the specified name. |
页首
属性
名称 | 说明 | |
---|---|---|
Columns | Represents a collection of Column objects. Each Column object represents a column included in the foreign key. | |
CreateDate | Gets the date and time when the foreign key was created. | |
DateLastModified | Gets the date and time when the foreign key was last modified. | |
DeleteAction | Gets or sets the action taken when the row that is referenced by the foreign key is deleted. | |
ExecuteForScalar | 获取或设置 Boolean 属性值,该值指定对象是否设置为针对标量选项执行。 (从 SqlSmoObject 继承。) | |
ExtendedProperties | Represents a collection of ExtendedProperty objects. Each ExtendedProperty object represents an extended property on the ForeignKey object. | |
ID | Gets the ID value that uniquely identifies the foreign key. | |
IsChecked | Gets or sets the Boolean property value that specifies whether the foreign key constraint was enabled without checking existing rows. | |
IsEnabled | Gets or sets the Boolean property value that specifies whether the foreign key is enabled. | |
IsSystemNamed | Gets the Boolean property value that specifies whether the foreign key is named by the system or by the user. | |
IsTouched | 获取 Boolean 属性值,该值指定在服务器上对象属性是否已更新但尚未持久化。 (从 SqlSmoObject 继承。) | |
Name | Gets or sets the name of the foreign key. (覆盖 NamedSmoObject. . :: . .Name。) | |
NotForReplication | Gets the Boolean property value that specifies whether the foreign key is available for replication. | |
ObjectInSpace | 获取 Boolean 属性值,该值指定对象是否单独存在,或者对象是否直接或间接连接到 SQL Server 的实例。 (从 SqlSmoObject 继承。) | |
Parent | Gets or sets the Table object that is the parent of the ForeignKey object. | |
Properties | 获取表示对象属性的 Property 对象的集合。 (从 SqlSmoObject 继承。) | |
ReferencedKey | Gets the primary key referenced by the foreign key. | |
ReferencedTable | Gets or sets the table that contains the primary key referenced by the foreign key. | |
ReferencedTableSchema | Gets or sets the table schema that contains the primary key referenced by the foreign key. | |
ScalarResult | 获取所引用对象的标量结果。 (从 SqlSmoObject 继承。) | |
ScriptReferencedTable | Gets or sets the Boolean value that specifies whether to script the table referenced by the foreign key. | |
ScriptReferencedTableSchema | Gets or sets the Boolean value that specifies whether to script the schema of the table referenced by the foreign key. | |
State | Gets the state of the referenced object. (从 SmoObjectBase 继承。) | |
UpdateAction | Gets or sets the Boolean property value that specifies whether the foreign key supports cascading updates. | |
Urn | 获取唯一标识对象的统一资源名称 (URN) 地址值。 (从 SqlSmoObject 继承。) | |
UserData | Gets or sets user-defined data associated with the referenced object. (从 SmoObjectBase 继承。) |
页首
方法
页首
事件
名称 | 说明 | |
---|---|---|
PropertyChanged | 表示更改属性时发生的事件。 (从 SqlSmoObject 继承。) | |
PropertyMetadataChanged | 表示属性元数据更改时发生的事件。 (从 SqlSmoObject 继承。) |
页首
字段
名称 | 说明 | |
---|---|---|
m_ExtendedProperties | 表示一个属性,可以对该属性进行定义以便扩展 SqlSmoObject 提供的属性。 (从 SqlSmoObject 继承。) | |
singletonParent | 表示单一父级。 (从 SqlSmoObject 继承。) |
页首
显式接口实现
页首
注释
To get ForeignKey object properties, users can be a member of the public fixed server role.
To set ForeignKey object properties, users must have ALTER permission on the parent table or be a member of the db_owner fixed database role.
To create or drop a foreign key, users must have ALTER permission on the parent table or be a member of the db_owner fixed database role.
Thread Safety
此类型的任何公共静态(Microsoft Visual Basic 中的 Shared)成员在多线程操作中是安全的。不保证所有实例成员都是线程安全的。
线程安全
此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。不保证所有实例成员都是线程安全的。