2009-05-01 4 views
0

2 개의 공용 속성을 가진 간단한 기본 클래스 B가 있습니다. 이 클래스는 또 다른 공용 속성을 추가하는 다른 클래스 D에 의해 상속됩니다. 파생 클래스는 웹 서비스 호출에 의해 반환됩니다. ASP.Net에서 생성 된 페이지는 다음과 같습니다.Asp.Net/WSE asmx 페이지 생성기를 만드는 방법 파생 클래스에서 기본 클래스 속성을 추가하십시오.

'''<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 

클래스 B의 클래스 D와 클래스 D의 모든 공용 속성을 표시하는 방법이 있습니까? 클래스 D만이 웹 서비스 클라이언트에 유용합니다. 클래스 B는 보이지 않아야합니다. 고마워요

답변

0

IncludeInSchema = False로 클래스 B에서 XmlTypeAttribute를 사용해 보셨습니까? 그게 효과가 있을지 모르겠지만 가능성은 있습니다.

XmlTypeAttribute on MSDN for .NET 2.0

0

당신은 당신의 유형에 XmlSchemaProviderAttribute을 사용하고 기본 클래스의 분리없이 XSD 스키마를 반환하는 방법을 구현할 수 있습니다. 약간의 작업이지만 기존 기본 출력으로 시작하여 메소드 구현에 들어가기 전에 복사 및 붙여 넣기 작업을 수행 할 수 있습니다.

관련 문제