开发者

C# Delete problem with an object relating to another object

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.


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜