Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

ObservableCollection missing as Collection Type in WCF... RSS

1 reply

Last post Feb 17, 2010 09:17 PM by S. Dimitrov

(0)
  • hehrsson

    hehrsson

    Member

    26 Points

    86 Posts

    ObservableCollection missing as Collection Type in WCF since VS 2010 RC

    Feb 17, 2010 06:15 AM | LINK

    Hi,

    I've upgraded to VS 2010 RC but now I cannot update my WCF services [:(]

    When I right click a Servce Reference in my Silverlight 3 project and select Update Service Reference, all my ObservableCollections turn into Arrays. If i select Configure Service Reference, I se that ObservableCollection is missing in the Collection Type drop down, instead it says ( Custom ).

    It still worked using VS 2010 Beta 2, so something has happened to the RC.
    Although I have seen posts on the net describing the same problem with VS 2008, nothing I have experienced...

    I have found some workarounds on the net but they are not doable for us:
    * Convert the arrays returned to ObservableCollections (not good for performance, and we have hundreds of them...)
    * Manually edit the Reference.cs and change the arrays to ObservableCollections (we have a large line of business application with 12 services with hundreds of methods. We update services several times a day during development, we cannot modify the files manually every time, would take hours...)

    Anyone else had the same problem and a solution for it?
    Please help me, this is urgent, right now some of our team members who haven't upgraded yet have to update the services for the rest of us when we make changes, not a good solution...

     

    WCF 2010 RC ObservableCollection

  • S. Dimitrov

    S. Dimitrov

    Member

    16 Points

    3 Posts

    Re: ObservableCollection missing as Collection Type in WCF since VS 2010 RC

    Feb 17, 2010 09:17 PM | LINK

    Hi,

    I've experienced the same problem. An easy way to overcome this issue is to set through Configure Service Reference the Collection Type to System.Collections.ObjectModel.Collection. Update the service reference and in the Reference.cs(.vb) file replace "System.Collections.ObjectModel.Collection" with "System.Collections.ObjectModel.ObservableCollection".

    Not that clean a solution but still does the trick.