locked
Exposing Abstract classes over Ria Service 2010 Preview RRS feed

  • Question

  • I Have created an empty Entity Data Model, created a new entity named [Databases] and made it abstract, next I have created a new entity named [SqlDatabase] that inherits from [Databases] entity:
    http://twitpic.com/qqmv9

    Now I want to expose those enities so I´ve created a new Domain Service
    http://twitpic.com/qqmzn
    http://twitpic.com/qqn43

    But the Databases is disable makes sense as it is abstract, but what about SqlDatabase? why cant I expose it?

    ps: Using VS2010, Ria Services Preview.
    Wednesday, November 25, 2009 7:30 AM

Answers

  • RIA Services is designed so that the server defines the entities. If you could inherit the entities client side that would indicate that RIA Services should support serializing that inherited entity and sending it back to the server. Since the code generation is only one way, there is no way for the server to deserialize your inherited entity. Therefore, from the framework standpoint, it would be an error not to seal the entity classes as they truly are non-inheritable on the client.

    Now, to support inheritance, they had to unseal the classes. However, the reasons for the earlier sealing still exist and, according to the documentation, doing your own inheritance is unsupported and undefined. For all intents and purposes, they should still be considered sealed even if they aren't.

    Tuesday, December 1, 2009 4:39 PM

All replies

  • Hi Papaismurf,

    created a new entity named [Databases] and made it abstract, next I have created a new entity named [SqlDatabase] that inherits from [Databases] entity:
    http://twitpic.com/qqmv9

    After we ad Entity Data Modal(write your code), we need to compile it first. 

    Best regards,

    Jonathan

    Monday, November 30, 2009 5:20 AM
  • Jonathan, I have compiled and the entities don´t show anyway...
    Monday, November 30, 2009 6:15 AM
  • I'm having the same problem.

    I have to differ with you on something, though.  The abstract class should be recognizable to the client.  I should be able to have an association from an Entity to that abstract Entity.

    I've taken the "abstract" keyword off of the class' signature &, since RIA generates all of the client-side classes as "sealed", I can't use any inheritance.

    What's the deal?

    Tuesday, December 1, 2009 3:21 PM
  • I've taken the "abstract" keyword off of the class' signature &, since RIA generates all of the client-side classes as "sealed", I can't use any inheritance.

    What's the deal?

    The inheritance has to be set server side, you can modify it client side which is why it is sealed. You also have to be using the VS2010/SL4 version of WCF RIA Services to use inheritance.

    Tuesday, December 1, 2009 3:36 PM
  • By SL4, you're referring to Silverlight v4.0, right?

    Tuesday, December 1, 2009 4:17 PM
  • Also, out of curiosity, why are the generated classes sealed?  Why am I not allowed to inherit, client-side, from a server-side class.

    That's not what I was trying to do, but I don't see why I shouldn't be able to.

    Tuesday, December 1, 2009 4:19 PM
  • RIA Services is designed so that the server defines the entities. If you could inherit the entities client side that would indicate that RIA Services should support serializing that inherited entity and sending it back to the server. Since the code generation is only one way, there is no way for the server to deserialize your inherited entity. Therefore, from the framework standpoint, it would be an error not to seal the entity classes as they truly are non-inheritable on the client.

    Now, to support inheritance, they had to unseal the classes. However, the reasons for the earlier sealing still exist and, according to the documentation, doing your own inheritance is unsupported and undefined. For all intents and purposes, they should still be considered sealed even if they aren't.

    Tuesday, December 1, 2009 4:39 PM