Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Removed foreign key #6504


User avatar
0
niengineering created

Hi,

do you have a standard solution for the removal of referenced key? An example:

public class UM : FullAuditedEntity, IMustHaveTenant { ... } public class Article : FullAuditedEntity, IMustHaveTenant { ... [Required] [ForeignKey("UM_Stock_Id")] public virtual UM UM_Stock { get; set; } public virtual int? UM_Stock_Id { get; set; } ... }

Now:

  • I add UM #1
  • I add Article X adding a reference to UM #1
  • If I try to remove UM #1 I need to raise an error, actually UM #1 is marked as deleted and the Article X contains the reference to the deleted record on UM.

Thank you


1 Answer(s)