views:

416

answers:

1

Hello

I'm having a function that should both update and insert, using the entity framework.

Was wondering if SaveChanges should be used in both cases?

if(Something == newThingy)
//do something
myobj.SaveChanges();

or is it done differently? /M

+2  A: 

Yes, it should.

Rik
How would that look codewise?
molgan
I see I made an error about UpdateObject; I was thinking about ADO.NET Data services. In Entity you don't need to do this. Just calling savechanges will suffice.
Rik
Here's some code http://msdn.microsoft.com/en-us/library/bb336792.aspx
Junior Mayhé