Back to list
Views:   4.4K
Replies:  0
Archived

Inheritance in the Design Pattern Framework

Hello.

The sample code doesn't come with types that inherit from base types.

So I'm wondering, in the case of DTO's, would adding a "KnownType" attribute for each descendant to the base type be the way to handle this? I've attached a code example. It's probably obvious, but "BaseDevice" is the abstract base, and Camera and Phone are descendants.

Also, what would change in the DataTransferObjectMapper, if anything?

Thanks in advance,

Mike
<DataContract(Name:="BaseDevice"),
    KnownType(GetType(CameraDto)),
    KnownType(GetType(PhoneDto))>
    Public Class BaseDeviceDto
        ''' <summary>
        '''  Internal stock keeping unit code.
        ''' </summary>
        <DataMember()>
        Public SKU As String

        ''' <summary>
        ''' A friendly description.
        ''' </summary>
        <DataMember(Name:="Desc")>
        Public Description As String
    End Class

 
Michael Lopez, Jun 29, 2012


Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas.      Vsn 1.2.2