locked
OData v3 WCF Client Dervied types issue with generated code RRS feed

  • Question

  • When generating code against a service which has abstract types (from which other types are derived) then the PropertyChanged events are created both on the abstract type and the derived type.  On the abstract type these should be abstract, and on the derived type they should be overrides, however they are generated on both, resulting in the 'hides inherited member' warning.

    thargy

    Craig Dean (MCPD)
    Chief Executive
    www.webappuk.com

    Please consider marking this as the answer if you have been genuinely helped!

    Tuesday, January 15, 2013 10:16 AM

Answers

  • I was able to repro the problem - the issue happens if the base type and derived type are in different namespaces. I have logged a bug on our side to fix this.

    Thanks to Craig for reporting this.


    This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by thargy Saturday, January 19, 2013 5:57 AM
    Friday, January 18, 2013 9:40 PM
    Moderator

All replies

  • Which version of WCF Data services are you using? I tried using the latest bits and I could not repro it with one level of hierarchy (base type is abstract and the derived type is not). If you do not mind, can you please share the $metadata output with me - please send it to pratikp at microsoft dot com.

    Thanks

    Pratik


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, January 16, 2013 6:25 PM
    Moderator
  • Hello,

    Can you provide a sample which can demonstrate the issue.

    Thanks,

    -Sandeep Chalke.

    Thursday, January 17, 2013 5:48 PM
  • Thanks Pratik,

    I have emailed you the metadata.


    thargy

    Craig Dean (MCPD)
    Chief Executive
    www.webappuk.com

    Please consider marking this as the answer if you have been genuinely helped!

    Friday, January 18, 2013 10:08 AM
  • Hi Sandeep,

    My current example is large and client-confidential, so I can't post it here.

    Thanks.


    thargy

    Craig Dean (MCPD)
    Chief Executive
    www.webappuk.com

    Please consider marking this as the answer if you have been genuinely helped!

    Friday, January 18, 2013 10:08 AM
  • I was able to repro the problem - the issue happens if the base type and derived type are in different namespaces. I have logged a bug on our side to fix this.

    Thanks to Craig for reporting this.


    This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by thargy Saturday, January 19, 2013 5:57 AM
    Friday, January 18, 2013 9:40 PM
    Moderator
  • This issue has been fixed in our latest bits. So the next release will have the fix.

    Craig, you also reported another issue about global:: prefix not being generated for complex types. Currently we generate global:: prefixes on everything that is not defined in the $metadata (System types, OData types, etc). In other words, anything external to the system will have global:: prefix. For anything that is defined in the $metadata (Complex types, Entity Types, EntityContainer, etc), we do not generate global:: prefixes for them. Does this make sense? Is there a reason why you need global:: prefix for complex types.

    Thanks

    Pratik


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, January 25, 2013 6:07 PM
    Moderator
  • Hi Pratik,

    The sample I sent you when generated does not compile due to missing global:: prefixes on various elements in the reference.cs - which then have to be added manually (which is a long process).

    Tomorrow, I will try and email an updated metadata schema and a 'before' and 'after' reference.cs so you can diff for the missing global:: prefixes, would that help?


    thargy

    Craig Dean (MCPD)
    Chief Executive
    www.webappuk.com

    Please consider marking this as the answer if you have been genuinely helped!

    Friday, January 25, 2013 8:44 PM
  • That will definitely help. I tried generating the code in both C# and VB with the metadata files you send me. Earlier, I was getting all the warnings about the INotifyPropertyChanged methods getting overridden, but after I fixed that issue, I was able to compile my app without any issues. So I am not sure why not having global:: prefix for complex type is causing issues in your scenario. Also, why is specific to complex types? We currently do not generate global:: prefix for entity types also. Why are they not causing any issues?

    Thanks

    Pratik


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, January 25, 2013 9:53 PM
    Moderator
  • Thanks Pratik,

    I have emailed you a complete example with generated and manually corrected reference.cs.

    We had an email account hacked earlier this week which led to our domain being blacklisted, although we've corrected some servers are still catching up so please check you junk mail if you can't see it.  If it's not there let me know and I'll send via a non-work account

    Craig


    thargy

    Craig Dean (MCPD)
    Chief Executive
    www.webappuk.com

    Please consider marking this as the answer if you have been genuinely helped!

    Saturday, January 26, 2013 8:41 AM