Appearance
ForeignKeyAttribute Class
Definition
Declares a foreign-key constraint on a mapped property for schema generation and reconciliation.
- Namespace:
JASE.Database - Assembly:
JASE.Database.dll
Constructors
| Name | Description |
|---|---|
ForeignKeyAttribute(Type relatedType) | Declares a foreign key that references the primary key of relatedType. |
ForeignKeyAttribute(Type relatedType, string referenceColumn) | Declares a foreign key that references a specific column on relatedType. |
ForeignKeyAttribute(string referenceSchema, string referenceTable, string referenceColumn) | Declares a foreign key using explicit schema, table, and column names. |
ForeignKeyAttribute(string referenceTable, string referenceColumn) | Declares a foreign key using explicit table and column names. |
Properties
| Name | Description |
|---|---|
Name | Optional constraint name. When null or empty, a default name is generated. |
OnDelete | Action when a referenced row is deleted. Defaults to Unspecified. |
OnUpdate | Action when a referenced key is updated. Defaults to Unspecified. |
ReferenceColumn | Referenced column name (or property name when using the typeof form). |
ReferenceSchema | Referenced schema when using the string form; otherwise null. |
ReferenceTable | Referenced table when using the string form; otherwise null. |
RelatedType | Related POCO type when using the typeof form; otherwise null. |
Remarks
Prefer the .ctor form so the referenced table, schema, and primary-key column are resolved from the related POCO. Use the string overloads when the target is not represented by a type in the calling assembly. This attribute defines a database constraint; it is separate from RelatedAttribute, which is used only for join / related-POCO hydration.