Q: Best way to handle cross-entity operations? (Many to many)
question: best way handle cross entity operations?
the obvious (problematic) example can think of entities in many-many relationships, 1 side of many acts "child" of parent side. i.e. when of child.parents deleted, child should delete self also.(i should point out client side can not see parents, have access limited scope, lazy loading/auth reasons)
initially thought modify delete entityservice method, if child null query db child, query child's join entities, if count 0, delete child. however, problem is...e.g.:
delete 2 joinentities, deleting first, result in querying second. when second delete method gets invoked, give exception (entity same key exists)
what best way deal scenario?
i can think of few possible solutions.
a) handle error, search entity manually in context (this sounds horrible idea thou)
b) instead of doing query+check in delete method, in override e.g. after base.executechangeset() (or possibly beforepersistchangeset thou choose former)
hi,
acoording description, think question more linq entities.
but this silverlight forum. suggest post question on linq entities forum more helps.
http://social.msdn.microsoft.com/forums/en/adodotnetentityframework/threads
hope help.
regards
Silverlight > WCF RIA Services with Silverlight
Comments
Post a Comment