путь многократного каскадного удаления в отношении "многие-многие" (EF 4.1)

ТАБЛИЦЫ:

Shop
Product
Category

ВЗАИМООТНОШЕНИЯ:

      (Shop) 1 <---> n (Categories)
      (Shop) 1 <---> n (Products)
(Categories) n <---> n (Products)

КАСКАД УДАЛЯЕТ:

      Shop  ---> Categories ... I defined this using fluent API
      Shop  ---> Products   ... I defined this using fluent API
Categories <---> Products   ... EF 4.1 automatically defines cascade for "Category_Product" join table

ПРОБЛЕМУ: Above results in a "multiple" cascade deletion path exception.

POTENTIAL FIXES:

  1. Remove the ManyToManyConvention, but that means I must manually perform deletes for every join table in the system, which is impractical.
  2. I can remove the cascade delete from Shop->Category or Shop->Products. But then I'll probably have lots of orphaned records.

How are you folks dealing with this problem?

THANKS

5
задан Matt0 20 May 2011 в 08:35
поделиться