locked
Add to Entity Collection RRS feed

  • Question

  • Hello,

    I am having an issue integrating the Entity Framework into our existing project. We have a tiered application that separates the UI, Business Logic, and Business Logic API. We use Lists to hold all of our objects. We have listeners (events) on these lists to let the UI know when something has been added to the list. The UI will update when it sees an update to any of these lists.

    My issue is when integrating the Entity Framework we are doing double the work in memory because we add the object to the list mentioned above and also to the entity collection. We would like to eliminate this.

    What is the best way to do this? I've tried to add logic so that whenever you add an object to the list, it adds it to the entity collection instead. I've been unsuccessful with this approach.

    Thank you for your help.
    Tuesday, May 5, 2009 1:09 PM

Answers

  • Hi shakalama,

    Thanks for the reply...I was beginning to think that there was no answer to my question!

    After pulling out a few hairs, I got this working.  What I did is wrap a generic entitycollection object in the list so that when you add to the list you are really adding to the entity collection.

    Thanks so much for your help.
    Wednesday, May 6, 2009 8:09 PM

All replies

  • Hi,
    i asked the same question with no answer i guess the only way to do that is to use linq

    http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/9e7e90c0-e4b2-447f-9f6b-74e7c2270601

    as far as i    know the entity objects are reference types so when you add to lists it does not add the object to the list it just add reference to it so its not much of memory as you think but sure there must be a better way to do that

    hope this helps
    http://fromisraeltolebanon.info
    Wednesday, May 6, 2009 5:26 PM
  • Hi shakalama,

    Thanks for the reply...I was beginning to think that there was no answer to my question!

    After pulling out a few hairs, I got this working.  What I did is wrap a generic entitycollection object in the list so that when you add to the list you are really adding to the entity collection.

    Thanks so much for your help.
    Wednesday, May 6, 2009 8:09 PM