3

We have two assemblies A and B where B extends from A. B has a property of a type in A

If we have a record of B in de database and we delete A wich is used by B the record will be removed

How can we prevent this in code because we will show a delete link or not if we can or can't delete A. Because B always need a type of A and if A is in used by a record of B, A may not be removed.

We use NHibernate as ORM.

Marco
  • 2,306
  • 2
  • 26
  • 43

2 Answers2

2

Use the cascade feature in the ORM, and exploit it properly
You might Read This Question in the forum first.

Community
  • 1
  • 1
Mehdi LAMRANI
  • 11,289
  • 14
  • 88
  • 130
1

You can check relations in sql Or triggers witch you can use for prevent deleting

And for the delete link i think you must check into the code and write a method for it