views:

186

answers:

2

I have a simple base class B with 2 public properties. This class is inherited by another class D that adds another public property. The derived class is returned by a web service call. The page generated by ASP.Net looks like:

'''<remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.3074"), _
     System.SerializableAttribute(), _
     System.Diagnostics.DebuggerStepThroughAttribute(), _
     System.ComponentModel.DesignerCategoryAttribute("code"), _
     System.Xml.Serialization.XmlTypeAttribute([Namespace]:="")> _
    Partial Public Class D
        Inherits B

        Private guidField As String

        '''<remarks/>
        Public Property Guid() As String
            Get
                Return Me.guidField
            End Get
            Set(ByVal value As String)
                Me.guidField = value
            End Set
        End Property
    End Class

   '''<remarks/>
    <System.Xml.Serialization.XmlIncludeAttribute(GetType(D)), _
     System.Xml.Serialization.XmlIncludeAttribute(GetType(B)), _
     System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.3074"), _
     System.SerializableAttribute(), _
     System.Diagnostics.DebuggerStepThroughAttribute(), _
     System.ComponentModel.DesignerCategoryAttribute("code"), _
     System.Xml.Serialization.XmlTypeAttribute([Namespace]:="")> _
    Partial Public MustInherit Class B

        Private nameField As String

        Private descriptionField As String

        '''<remarks/>
        Public Property Name() As String
            Get
                Return Me.nameField
            End Get
            Set(ByVal value As String)
                Me.nameField = value
            End Set
        End Property

        '''<remarks/>
        Public Property Description() As String
            Get
                Return Me.descriptionField
            End Get
            Set(ByVal value As String)
                Me.descriptionField = value
            End Set
        End Property
    End Class

Is there any way to show all the public properties (from class B and class D in class D)? Only class D is useful for the web service clients, class B should not be even visible. Thank You

A: 

Have you tried the XmlTypeAttribute on class B with IncludeInSchema=False? I don't know if that would work, but it's a possibility.

XmlTypeAttribute on MSDN for .NET 2.0

JJO
A: 

You can use the XmlSchemaProviderAttribute on your type and implement a method that returns the xsd schema without the base class separation. It's a bit of work, but you can start with the existing default output and do a little copy and paste work before dropping into the method implementation.

Casey Chamberlain