Konstantin
Konstantin

Reputation: 3696

Database "on delete cascade" mapping

Anybody know if fluent NHibernate can be used to generate keys with "on delete cascade", when using XML mappings for NHibernate it is called "on-delete='cascade'".

Reason I want this is that the other end of my mapping holds a large blob so it would be convenient if it just "disappeared"

Upvotes: 1

Views: 82

Answers (2)

Diego Mijelshon
Diego Mijelshon

Reputation: 52725

It's simple:

HasMany(x => x.YourCollection).Inverse().ForeignKeyCascadeOnDelete();

Upvotes: 2

kaffeemeister
kaffeemeister

Reputation: 61

On the column, use Cascade.Delete(), there's other options as well.

Upvotes: 1

Related Questions