How can I save an Icollection in an object?

Let’s learn how can I save an Icollection in an object. The most accurate or helpful solution is served by Stack Overflow.

There are ten answers to this question.

Best solution

Code first - how can I save an ICollection when I'm not setting the parent object to EntityState.Modified?

If I have the below class: public class Foo() { public int PropertyIWantUpdated {get; set;} public int PropertyIDontWantUpdated (get; set} public ICollection<Bar> Bars {get; set;} } When saving to my db, instead of context.Entry(thisFoo).State = EntityState.Modified; I'm using context.Entry(thisFood).Property(tf => tf.PropertyIWantUpdated).IsModified = true; how can I also save changes to Bars?

Answer:

It depends what you are trying to update. First of all let me clarify one important fact - if you have...

Read more

Dave at Stack Overflow Mark as irrelevant Undo

Other solutions

Cannot send message or save it. I receive an error message "object doesn't support this property or method"?

why can I not send a message. when I compose a new message and click send I get an error message "Object doesnt support this property or method" Cannot send the message or save ...show more

Answer:

Me to im getting the same message it works if you switch back to classic but i need the new mail please...

Read more

LAQU6YELEMQANYVJETP4X55CDA at Yahoo! Answers Mark as irrelevant Undo

Answer:

I would save any sort of food item that I could, or perhaps a pocket knife.

Read more

Ryan B. at ChaCha Mark as irrelevant Undo

Answer:

Abraham Lincoln said this quote My paramount object in this struggle is to save the Union, and is not...

Read more

wiki.answers.com Mark as irrelevant Undo

Answer:

Abraham Lincoln said this in a letter addressed to newspaper editor Horace Greeley on Aug 11, 1862.

Read more

Anonymous at ChaCha Mark as irrelevant Undo

Answer:

the water tower. The actual water tower is in Northbrook Illinois, hometown of the movie's director...

Read more

wiki.answers.com Mark as irrelevant Undo

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.