Hi Aaron;
Ok, I'm still not entirely clear on your questions so I'm just
going to give my assumptions and possible answers here.
Assumption 1: You
have a database view made up from some tables exposed to your ViewModel and
DevForce is used to retrieve, insert and update data from that view. You're
asking whether you should check the existence of a row first in the table to
decide whether to do an insert or update.
Answer 1: No you don't need to
check or do an AttachEntity. If you make your database view updatable (as shown
here,
http://blogs.msdn.com/b/alexj/archive/2009/09/01/tip-34-how-to-work-with-updatable-views.aspx.)
any insert/update you make to the database view is automatically handled by
EntityFramework and applied to its corresponding table(s).
Assumption
2: You have the view-backed entity and then other entity types representing
tables in that view and it is in fact updatable.
Answer 2:
EntityFramework, not DevForce, will determine how to insert/update the
underlying tables when you make changes to instances of this entity type. You
don’t need to do an attach or anything else. You can query these entities into
cache and then make modifications as usual.
Conclusion: Regardless of
whether you already have an updatable view or not, we delegate all of this to
EntityFramework so whatever EntityFramework supports, we do too.
Hope
this helps.
Regards,
Denis