ForeignKeyAttribute
Declares that a plain scalar id property is a foreign key to ReferencedType, without exposing a navigation property. Use on a raw id column (for example long / long?) that the model deliberately keeps as an id but that has — or should have — a database foreign key. Schema comparison then treats the column as a known foreign key: an existing constraint is not reported as an "extra" FK, and a missing one surfaces as MissingForeignKey. The value still loads and persists as an ordinary scalar; this attribute only affects schema comparison.
継承元: Attribute
コンストラクター
public ForeignKeyAttribute(Type referencedType)
foreignKeyAttribute = ForeignKeyAttribute(referencedType)
Declares that a plain scalar id property is a foreign key to ReferencedType, without exposing a navigation property. Use on a raw id column (for example long / long?) that the model deliberately keeps as an id but that has — or should have — a database foreign key. Schema comparison then treats the column as a known foreign key: an existing constraint is not reported as an "extra" FK, and a missing one surfaces as MissingForeignKey. The value still loads and persists as an ordinary scalar; this attribute only affects schema comparison.
- referencedType
- The entity type the column references.
プロパティ
public Type ReferencedType { get; }
value = foreignKeyAttribute.ReferencedType
The entity type this foreign-key column references.