entity framework - Filter one mapped collection vs. Map two collections -


i have one-to-many relationship 'child' entity can soft deleted. must load parent instance containing child instances in 2 different scenarios:

  1. edit scenario: load children including have been "deleted".
  2. view scenario: load children have not been "deleted".

i can think of 2 different ways implement in domain model, , question is: way(s) is(are) supported ef code-first , what's relative complexity of each?

  1. two mapped collection properties: ilist<child> children , ilist<child> deletedchildren.
  2. one mapped collection property ilist<child> children , isactive property on child marking children have not been deleted. scenario 2 need load parent such children filtered contain instances haven't been deleted.

i mention, in case matters, situation hierarchical (but 2 levels deep). is, children parents "soft delete" situation.


Comments