New Posts New Posts RSS Feed: Insert / Update
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Insert / Update

 Post Reply Post Reply
Author
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Topic: Insert / Update
    Posted: 24-Aug-2011 at 10:13am
Hi Aaron;

This sounds like a similar question you had sent to our support system. I've replied to this question yesterday at 7:26 pm so I'm assuming you did not get it. Here's my reply again.

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
Back to Top
daw451 View Drop Down
Newbie
Newbie


Joined: 23-May-2011
Posts: 3
Post Options Post Options   Quote daw451 Quote  Post ReplyReply Direct Link To This Post Posted: 24-Aug-2011 at 6:19am

do I need to check for the existence of a row to decide whether to do an update or an insert? Is there a way to attach the entities and do an async save and let ideablade determine whether to update it or insert it.

Thanks
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down