Windows Vista Forums

WFC and Inherited List
  1. #1


    Andreas Håkansson Guest

    WFC and Inherited List

    Hi

    Im trying out WCF for the first time and have hit a small snag. In my
    project I have a class called Passenger which simplified look like this

    <DataContract> _
    Public Class Passenger

    <DebuggerBrowsable(DebuggerBrowsableState.Never)> _
    Protected mAge As Integer = 0

    <DataMember()> _
    Public Property Age() As Integer
    <DebuggerStepThrough()> _
    Get
    Return Me.mAge
    End Get
    <DebuggerStepThrough()> _
    Set(ByVal value As Integer)
    Me.mAge = value
    End Set
    End Property

    End Class

    I then have a strong type collection of Passengers with an additional method

    <DataContract()> _
    Public Class PassengerList
    Inherits List(Of Passenger)

    Public Function FooBar() As Boolean
    ' Some code that doesn't matter
    End Function

    End Class

    The PassengerList object is then exposed through my service contract. When I
    try to add a Service Reference in my client project I get an error. Now I
    assume
    this has to do that since the members of List(Of T) which I inherit do not
    have the DataMember attribute added to its members (like the items). How is
    this kind of
    stuff done in a "Correct WFC way" ?



    Thanks for your advice!


    //Andreas


      My System SpecsSystem Spec

  2. #2


    Vadym Stetsyak Guest

    Re: WFC and Inherited List

    Hello, Andreas!

    what error do you get?

    Have a look at ( http://msdn2.microsoft.com/en-us/library/ms730167.aspx )
    to known more about how to handle inheritance in data contracts

    You wrote on Thu, 14 Dec 2006 13:55:13 +0100:

    AH> Im trying out WCF for the first time and have hit a small snag. In my
    AH> project I have a class called Passenger which simplified look like this

    AH> <DataContract> _
    AH> Public Class Passenger

    AH> <DebuggerBrowsable(DebuggerBrowsableState.Never)> _
    AH> Protected mAge As Integer = 0

    AH> <DataMember()> _
    AH> Public Property Age() As Integer
    AH> <DebuggerStepThrough()> _
    AH> Get
    AH> Return Me.mAge
    AH> End Get
    AH> <DebuggerStepThrough()> _
    AH> Set(ByVal value As Integer)
    AH> Me.mAge = value
    AH> End Set
    AH> End Property

    AH> End Class

    AH> I then have a strong type collection of Passengers with an additional
    AH> method

    AH> <DataContract()> _
    AH> Public Class PassengerList
    AH> Inherits List(Of Passenger)

    AH> Public Function FooBar() As Boolean
    AH> ' Some code that doesn't matter
    AH> End Function

    AH> End Class

    AH> The PassengerList object is then exposed through my service contract.
    AH> When I try to add a Service Reference in my client project I get an
    AH> error. Now I assume
    AH> this has to do that since the members of List(Of T) which I inherit do
    AH> not have the DataMember attribute added to its members (like the
    AH> items). How is this kind of
    AH> stuff done in a "Correct WFC way" ?

    AH> Thanks for your advice!


    With best regards, Vadym Stetsyak. E-mail: vadym_s@ukr.net


      My System SpecsSystem Spec

  3. #3


    Andreas Håkansson Guest

    Re: WFC and Inherited List

    Hello, Vadym

    The error messages I get are



    ###

    If you would like more help, type "svcutil /?"

    Error: Cannot obtain Metadata from http://localhost:8081/Search

    If this is a Windows (R) Communication Foundation service to which you have
    access, please check that you have enabled metadata publishing at the
    specified address. For help enabling metadata publishing, please refer to
    the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.

    WS-Metadata Exchange Error

    URI: http://localhost:8081/Search

    Metadata contains a reference that cannot be resolved:
    'http://localhost:8081/Search'.

    There was no endpoint listening at http://localhost:8081/Search that could
    accept the message. This is often caused by an incorrect address or SOAP
    action. See InnerException, if present, for more details.

    The remote server returned an error: (404) Not Found.

    HTTP GET Error

    URI: http://localhost:8081/Search

    There was an error downloading 'http://localhost:8081/Search'.

    The request failed with the error message:

    --

    <HTML><HEAD><STYLE type="text/css">#content{ FONT-SIZE: 0.7em;
    PADDING-BOTTOM: 2em; MARGIN-LEFT: 30px}BODY{MARGIN-TOP: 0px; MARGIN-LEFT:
    0px; COLOR: #000000; FONT-FAMILY: Verdana; BACKGROUND-COLOR:
    white}P{MARGIN-TOP: 0px; MARGIN-BOTTOM: 12px; COLOR: #000000; FONT-FAMILY:
    Verdana}PRE{BORDER-RIGHT: #f0f0e0 1px solid; PADDING-RIGHT: 5px; BORDER-TOP:
    #f0f0e0 1px solid; MARGIN-TOP: -5px; PADDING-LEFT: 5px; FONT-SIZE: 1.2em;
    PADDING-BOTTOM: 5px; BORDER-LEFT: #f0f0e0 1px solid; PADDING-TOP: 5px;
    BORDER-BOTTOM: #f0f0e0 1px solid; FONT-FAMILY: Courier New;
    BACKGROUND-COLOR: #e5e5cc}.heading1{MARGIN-TOP: 0px; PADDING-LEFT: 15px;
    FONT-WEIGHT: normal; FONT-SIZE: 26px; MARGIN-BOTTOM: 0px; PADDING-BOTTOM:
    3px; MARGIN-LEFT: -30px; WIDTH: 100%; COLOR: #ffffff; PADDING-TOP: 10px;
    FONT-FAMILY: Tahoma; BACKGROUND-COLOR:
    #003366}.intro{MARGIN-LEFT: -15px}</STYLE><TITLE>Service</TITLE></HEAD><BODY><DIV
    id="content"><P class="heading1">Service</P><BR/><P class="intro">The server
    was unable to process the request due to an internal error. For more
    information about the error, either turn on IncludeExceptionDetailInFaults
    (either from ServiceBehaviorAttribute or from the <serviceDebug>
    configuration behavior) on the server in order to send the exception
    information back to the client, or turn on tracing as per the Microsoft .NET
    Framework 3.0 SDK documentation and inspect the server trace
    logs.</P></DIV></BODY></HTML>

    --.

    ###






    This only happens as soon as I try to include the property that returns a
    Passengers object (Renamed from PassengerList). Below is the object graph
    that is exposed in my ServiceContract. SearchPararametersBase is the type
    thats is the service contract. If I replace the Passengers property (on the
    SearchParametersBase class) with a string property, then the client
    application
    has no problem to add the Service Reference.


    <DataContract()> _
    Public Class SearchParametersBase

    #Region "Passengers"

    <DebuggerBrowsable(DebuggerBrowsableState.Never)> _
    Protected mPassengers As Passengers = New Passengers()

    Public Property Passengers() As Passengers
    <DebuggerStepThrough()> _
    Get
    Return Me.mPassengers
    End Get
    <DebuggerStepThrough()> _
    Set(ByVal value As Passengers)
    If (value Is Nothing) Then
    Throw New ArgumentNullException("Passengers", "Passengers
    cannot be null.")
    End If
    Me.mPassengers = value
    End Set
    End Property

    #End Region

    End Class


    <CollectionDataContract(), KnownType("GetKnownType")> _
    Public Class Passengers
    Inherits List(Of Passenger)

    #Region "GetKnownType"

    Private Function GetKnownType() As Type()
    Return New Type() {GetType(Passenger)}
    End Function

    #End Region

    End Class


    <DataContract()> _
    Public Class Passenger

    #Region "Age"

    <DebuggerBrowsable(DebuggerBrowsableState.Never)> _
    Protected mAge As Integer = 0

    <DataMember()> _
    Public Property Age() As Integer
    <DebuggerStepThrough()> _
    Get
    Return Me.mAge
    End Get
    <DebuggerStepThrough()> _
    Set(ByVal value As Integer)
    If ((value < 0) OrElse (value > 99)) Then
    Throw New ArgumentOutOfRangeException("Age", value, "Age cannot be less
    than zero or larger than 99.")
    End If
    Me.mAge = value
    End Set
    End Property

    #End Region

    End Class









    "Vadym Stetsyak" <vadym_s@ukr.net> skrev i meddelandet
    news:eDeiKIHIHHA.1248@TK2MSFTNGP02.phx.gbl...
    > Hello, Andreas!
    >
    > what error do you get?
    >
    > Have a look at ( http://msdn2.microsoft.com/en-us/library/ms730167.aspx )
    > to known more about how to handle inheritance in data contracts
    >
    > You wrote on Thu, 14 Dec 2006 13:55:13 +0100:
    >
    > AH> Im trying out WCF for the first time and have hit a small snag. In my
    > AH> project I have a class called Passenger which simplified look like
    > this
    >
    > AH> <DataContract> _
    > AH> Public Class Passenger
    >
    > AH> <DebuggerBrowsable(DebuggerBrowsableState.Never)> _
    > AH> Protected mAge As Integer = 0
    >
    > AH> <DataMember()> _
    > AH> Public Property Age() As Integer
    > AH> <DebuggerStepThrough()> _
    > AH> Get
    > AH> Return Me.mAge
    > AH> End Get
    > AH> <DebuggerStepThrough()> _
    > AH> Set(ByVal value As Integer)
    > AH> Me.mAge = value
    > AH> End Set
    > AH> End Property
    >
    > AH> End Class
    >
    > AH> I then have a strong type collection of Passengers with an additional
    > AH> method
    >
    > AH> <DataContract()> _
    > AH> Public Class PassengerList
    > AH> Inherits List(Of Passenger)
    >
    > AH> Public Function FooBar() As Boolean
    > AH> ' Some code that doesn't matter
    > AH> End Function
    >
    > AH> End Class
    >
    > AH> The PassengerList object is then exposed through my service contract.
    > AH> When I try to add a Service Reference in my client project I get an
    > AH> error. Now I assume
    > AH> this has to do that since the members of List(Of T) which I inherit
    > do
    > AH> not have the DataMember attribute added to its members (like the
    > AH> items). How is this kind of
    > AH> stuff done in a "Correct WFC way" ?
    >
    > AH> Thanks for your advice!
    >
    >
    > With best regards, Vadym Stetsyak. E-mail: vadym_s@ukr.net
    >



      My System SpecsSystem Spec

  4. #4


    Vadym Stetsyak Guest

    Re: WFC and Inherited List

    Hello, Andreas!

    This message
    "
    The server
    was unable to process the request due to an internal error. For more
    information about the error, either turn on IncludeExceptionDetailInFaults
    (either from ServiceBehaviorAttribute or from the <serviceDebug>
    configuration behavior) on the server in order to send the exception
    information back to the client, or turn on tracing as per the Microsoft .NET
    Framework 3.0 SDK documentation and inspect the server trace
    logs.
    "
    tells that IncludeExceptionDetailInFaults is set to false. Set it to true
    this will give more info about the problem.



    You wrote on Mon, 18 Dec 2006 08:37:06 +0100:

    AH> The error messages I get are

    AH> ###

    AH> If you would like more help, type "svcutil /?"

    AH> Error: Cannot obtain Metadata from http://localhost:8081/Search

    AH> If this is a Windows (R) Communication Foundation service to which you
    AH> have access, please check that you have enabled metadata publishing at
    AH> the specified address. For help enabling metadata publishing, please
    AH> refer to the MSDN documentation at
    AH> http://go.microsoft.com/fwlink/?LinkId=65455.

    AH> WS-Metadata Exchange Error

    AH> URI: http://localhost:8081/Search

    AH> Metadata contains a reference that cannot be resolved:
    AH> 'http://localhost:8081/Search'.

    AH> There was no endpoint listening at http://localhost:8081/Search that
    AH> could accept the message. This is often caused by an incorrect address
    AH> or SOAP action. See InnerException, if present, for more details.

    AH> The remote server returned an error: (404) Not Found.

    AH> HTTP GET Error

    AH> URI: http://localhost:8081/Search

    AH> There was an error downloading 'http://localhost:8081/Search'.

    AH> The request failed with the error message:

    AH> --

    AH> <HTML><HEAD><STYLE type="text/css">#content{ FONT-SIZE: 0.7em;
    AH> PADDING-BOTTOM: 2em; MARGIN-LEFT: 30px}BODY{MARGIN-TOP: 0px;
    AH> MARGIN-LEFT: 0px; COLOR: #000000; FONT-FAMILY: Verdana;
    AH> BACKGROUND-COLOR: white}P{MARGIN-TOP: 0px; MARGIN-BOTTOM: 12px; COLOR:
    AH> #000000; FONT-FAMILY: Verdana}PRE{BORDER-RIGHT: #f0f0e0 1px solid;
    AH> PADDING-RIGHT: 5px; BORDER-TOP: #f0f0e0 1px solid; MARGIN-TOP: -5px;
    AH> PADDING-LEFT: 5px; FONT-SIZE: 1.2em; PADDING-BOTTOM: 5px; BORDER-LEFT:
    AH> #f0f0e0 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #f0f0e0 1px solid;
    AH> FONT-FAMILY: Courier New; BACKGROUND-COLOR:
    AH> #e5e5cc}.heading1{MARGIN-TOP: 0px; PADDING-LEFT: 15px; FONT-WEIGHT:
    AH> normal; FONT-SIZE: 26px; MARGIN-BOTTOM: 0px; PADDING-BOTTOM: 3px;
    AH> MARGIN-LEFT: -30px; WIDTH: 100%; COLOR: #ffffff; PADDING-TOP: 10px;
    AH> FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #003366}.intro{MARGIN-LEFT:
    AH> -15px}</STYLE><TITLE>Service</TITLE></HEAD><BODY><DIV id="content"><P
    AH> class="heading1">Service</P><BR/><P class="intro">The server was unable
    AH> to process the request due to an internal error. For more information
    AH> about the error, either turn on IncludeExceptionDetailInFaults (either
    AH> from ServiceBehaviorAttribute or from the <serviceDebug> configuration
    AH> behavior) on the server in order to send the exception information back
    AH> to the client, or turn on tracing as per the Microsoft .NET Framework
    AH> 3.0 SDK documentation and inspect the server trace
    AH> logs.</P></DIV></BODY></HTML>

    AH> --.

    AH> ###

    AH> This only happens as soon as I try to include the property that returns
    AH> a Passengers object (Renamed from PassengerList). Below is the object
    AH> graph that is exposed in my ServiceContract. SearchPararametersBase is
    AH> the type thats is the service contract. If I replace the Passengers
    AH> property (on the SearchParametersBase class) with a string property,
    AH> then the client application
    AH> has no problem to add the Service Reference.

    AH> <DataContract()> _
    AH> Public Class SearchParametersBase

    AH> #Region "Passengers"

    AH> <DebuggerBrowsable(DebuggerBrowsableState.Never)> _
    AH> Protected mPassengers As Passengers = New Passengers()

    AH> Public Property Passengers() As Passengers
    AH> <DebuggerStepThrough()> _
    AH> Get
    AH> Return Me.mPassengers
    AH> End Get
    AH> <DebuggerStepThrough()> _
    AH> Set(ByVal value As Passengers)
    AH> If (value Is Nothing) Then
    AH> Throw New ArgumentNullException("Passengers",
    AH> "Passengers cannot be null.")
    AH> End If
    AH> Me.mPassengers = value
    AH> End Set
    AH> End Property

    AH> #End Region

    AH> End Class

    AH> <CollectionDataContract(), KnownType("GetKnownType")> _
    AH> Public Class Passengers
    AH> Inherits List(Of Passenger)

    AH> #Region "GetKnownType"

    AH> Private Function GetKnownType() As Type()
    AH> Return New Type() {GetType(Passenger)}
    AH> End Function

    AH> #End Region

    AH> End Class

    AH> <DataContract()> _
    AH> Public Class Passenger

    AH> #Region "Age"

    AH> <DebuggerBrowsable(DebuggerBrowsableState.Never)> _
    AH> Protected mAge As Integer = 0

    AH> <DataMember()> _
    AH> Public Property Age() As Integer
    AH> <DebuggerStepThrough()> _
    AH> Get
    AH> Return Me.mAge
    AH> End Get
    AH> <DebuggerStepThrough()> _
    AH> Set(ByVal value As Integer)
    AH> If ((value < 0) OrElse (value > 99)) Then
    AH> Throw New ArgumentOutOfRangeException("Age", value, "Age cannot be
    AH> less than zero or larger than 99.")
    AH> End If
    AH> Me.mAge = value
    AH> End Set
    AH> End Property

    AH> #End Region

    AH> End Class

    AH> "Vadym Stetsyak" <vadym_s@ukr.net> skrev i meddelandet
    AH> news:eDeiKIHIHHA.1248@TK2MSFTNGP02.phx.gbl...
    ??>> Hello, Andreas!
    ??>>
    ??>> what error do you get?
    ??>>
    ??>> Have a look at (
    ??>> http://msdn2.microsoft.com/en-us/library/ms730167.aspx ) to known more
    ??>> about how to handle inheritance in data contracts You wrote on Thu,
    ??>> 14 Dec 2006 13:55:13 +0100:
    AH>>> Im trying out WCF for the first time and have hit a small snag. In my
    AH>>> project I have a class called Passenger which simplified look like
    ??>> this
    ??>>
    AH>>> <DataContract> _
    AH>>> Public Class Passenger
    ??>>
    AH>>> <DebuggerBrowsable(DebuggerBrowsableState.Never)> _
    AH>>> Protected mAge As Integer = 0
    ??>>
    AH>>> <DataMember()> _
    AH>>> Public Property Age() As Integer
    AH>>> <DebuggerStepThrough()> _
    AH>>> Get
    AH>>> Return Me.mAge
    AH>>> End Get
    AH>>> <DebuggerStepThrough()> _
    AH>>> Set(ByVal value As Integer)
    AH>>> Me.mAge = value
    AH>>> End Set
    AH>>> End Property
    ??>>
    AH>>> End Class
    ??>>
    AH>>> I then have a strong type collection of Passengers with an additional
    AH>>> method
    ??>>
    AH>>> <DataContract()> _
    AH>>> Public Class PassengerList
    AH>>> Inherits List(Of Passenger)
    ??>>
    AH>>> Public Function FooBar() As Boolean
    AH>>> ' Some code that doesn't matter
    AH>>> End Function
    ??>>
    AH>>> End Class
    ??>>
    AH>>> The PassengerList object is then exposed through my service contract.
    AH>>> When I try to add a Service Reference in my client project I get an
    AH>>> error. Now I assume
    AH>>> this has to do that since the members of List(Of T) which I inherit
    ??>> do
    AH>>> not have the DataMember attribute added to its members (like the
    AH>>> items). How is this kind of
    AH>>> stuff done in a "Correct WFC way" ?
    ??>>
    AH>>> Thanks for your advice!
    ??>>
    ??>> With best regards, Vadym Stetsyak. E-mail: vadym_s@ukr.net
    ??>>

    With best regards, Vadym Stetsyak. E-mail: vadym_s@ukr.net


      My System SpecsSystem Spec

  5. #5


    Andreas Håkansson Guest

    Re: WFC and Inherited List

    Excellent! Once I turned on the debug information I realized I had forgotten
    to make my KnownType method static so the problem was related to the fact
    that it could not locate the specified method. Thanks!

    "Vadym Stetsyak" <vadym_s@ukr.net> skrev i meddelandet
    news:eEIlvknIHHA.4384@TK2MSFTNGP03.phx.gbl...
    > Hello, Andreas!
    >
    > This message
    > "
    > The server
    > was unable to process the request due to an internal error. For more
    > information about the error, either turn on IncludeExceptionDetailInFaults
    > (either from ServiceBehaviorAttribute or from the <serviceDebug>
    > configuration behavior) on the server in order to send the exception
    > information back to the client, or turn on tracing as per the Microsoft
    > .NET
    > Framework 3.0 SDK documentation and inspect the server trace
    > logs.
    > "
    > tells that IncludeExceptionDetailInFaults is set to false. Set it to true
    > this will give more info about the problem.
    >
    >
    >
    > You wrote on Mon, 18 Dec 2006 08:37:06 +0100:
    >
    > AH> The error messages I get are
    >
    > AH> ###
    >
    > AH> If you would like more help, type "svcutil /?"
    >
    > AH> Error: Cannot obtain Metadata from http://localhost:8081/Search
    >
    > AH> If this is a Windows (R) Communication Foundation service to which you
    > AH> have access, please check that you have enabled metadata publishing at
    > AH> the specified address. For help enabling metadata publishing, please
    > AH> refer to the MSDN documentation at
    > AH> http://go.microsoft.com/fwlink/?LinkId=65455.
    >
    > AH> WS-Metadata Exchange Error
    >
    > AH> URI: http://localhost:8081/Search
    >
    > AH> Metadata contains a reference that cannot be resolved:
    > AH> 'http://localhost:8081/Search'.
    >
    > AH> There was no endpoint listening at http://localhost:8081/Search that
    > AH> could accept the message. This is often caused by an incorrect address
    > AH> or SOAP action. See InnerException, if present, for more details.
    >
    > AH> The remote server returned an error: (404) Not Found.
    >
    > AH> HTTP GET Error
    >
    > AH> URI: http://localhost:8081/Search
    >
    > AH> There was an error downloading 'http://localhost:8081/Search'.
    >
    > AH> The request failed with the error message:
    >
    > AH> --
    >
    > AH> <HTML><HEAD><STYLE type="text/css">#content{ FONT-SIZE: 0.7em;
    > AH> PADDING-BOTTOM: 2em; MARGIN-LEFT: 30px}BODY{MARGIN-TOP: 0px;
    > AH> MARGIN-LEFT: 0px; COLOR: #000000; FONT-FAMILY: Verdana;
    > AH> BACKGROUND-COLOR: white}P{MARGIN-TOP: 0px; MARGIN-BOTTOM: 12px; COLOR:
    > AH> #000000; FONT-FAMILY: Verdana}PRE{BORDER-RIGHT: #f0f0e0 1px solid;
    > AH> PADDING-RIGHT: 5px; BORDER-TOP: #f0f0e0 1px solid; MARGIN-TOP: -5px;
    > AH> PADDING-LEFT: 5px; FONT-SIZE: 1.2em; PADDING-BOTTOM: 5px; BORDER-LEFT:
    > AH> #f0f0e0 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #f0f0e0 1px solid;
    > AH> FONT-FAMILY: Courier New; BACKGROUND-COLOR:
    > AH> #e5e5cc}.heading1{MARGIN-TOP: 0px; PADDING-LEFT: 15px; FONT-WEIGHT:
    > AH> normal; FONT-SIZE: 26px; MARGIN-BOTTOM: 0px; PADDING-BOTTOM: 3px;
    > AH> MARGIN-LEFT: -30px; WIDTH: 100%; COLOR: #ffffff; PADDING-TOP: 10px;
    > AH> FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #003366}.intro{MARGIN-LEFT:
    > AH> -15px}</STYLE><TITLE>Service</TITLE></HEAD><BODY><DIV id="content"><P
    > AH> class="heading1">Service</P><BR/><P class="intro">The server was
    > unable
    > AH> to process the request due to an internal error. For more information
    > AH> about the error, either turn on IncludeExceptionDetailInFaults (either
    > AH> from ServiceBehaviorAttribute or from the <serviceDebug> configuration
    > AH> behavior) on the server in order to send the exception information
    > back
    > AH> to the client, or turn on tracing as per the Microsoft .NET Framework
    > AH> 3.0 SDK documentation and inspect the server trace
    > AH> logs.</P></DIV></BODY></HTML>
    >
    > AH> --.
    >
    > AH> ###
    >
    > AH> This only happens as soon as I try to include the property that
    > returns
    > AH> a Passengers object (Renamed from PassengerList). Below is the object
    > AH> graph that is exposed in my ServiceContract. SearchPararametersBase is
    > AH> the type thats is the service contract. If I replace the Passengers
    > AH> property (on the SearchParametersBase class) with a string property,
    > AH> then the client application
    > AH> has no problem to add the Service Reference.
    >
    > AH> <DataContract()> _
    > AH> Public Class SearchParametersBase
    >
    > AH> #Region "Passengers"
    >
    > AH> <DebuggerBrowsable(DebuggerBrowsableState.Never)> _
    > AH> Protected mPassengers As Passengers = New Passengers()
    >
    > AH> Public Property Passengers() As Passengers
    > AH> <DebuggerStepThrough()> _
    > AH> Get
    > AH> Return Me.mPassengers
    > AH> End Get
    > AH> <DebuggerStepThrough()> _
    > AH> Set(ByVal value As Passengers)
    > AH> If (value Is Nothing) Then
    > AH> Throw New ArgumentNullException("Passengers",
    > AH> "Passengers cannot be null.")
    > AH> End If
    > AH> Me.mPassengers = value
    > AH> End Set
    > AH> End Property
    >
    > AH> #End Region
    >
    > AH> End Class
    >
    > AH> <CollectionDataContract(), KnownType("GetKnownType")> _
    > AH> Public Class Passengers
    > AH> Inherits List(Of Passenger)
    >
    > AH> #Region "GetKnownType"
    >
    > AH> Private Function GetKnownType() As Type()
    > AH> Return New Type() {GetType(Passenger)}
    > AH> End Function
    >
    > AH> #End Region
    >
    > AH> End Class
    >
    > AH> <DataContract()> _
    > AH> Public Class Passenger
    >
    > AH> #Region "Age"
    >
    > AH> <DebuggerBrowsable(DebuggerBrowsableState.Never)> _
    > AH> Protected mAge As Integer = 0
    >
    > AH> <DataMember()> _
    > AH> Public Property Age() As Integer
    > AH> <DebuggerStepThrough()> _
    > AH> Get
    > AH> Return Me.mAge
    > AH> End Get
    > AH> <DebuggerStepThrough()> _
    > AH> Set(ByVal value As Integer)
    > AH> If ((value < 0) OrElse (value > 99)) Then
    > AH> Throw New ArgumentOutOfRangeException("Age", value, "Age cannot be
    > AH> less than zero or larger than 99.")
    > AH> End If
    > AH> Me.mAge = value
    > AH> End Set
    > AH> End Property
    >
    > AH> #End Region
    >
    > AH> End Class
    >
    > AH> "Vadym Stetsyak" <vadym_s@ukr.net> skrev i meddelandet
    > AH> news:eDeiKIHIHHA.1248@TK2MSFTNGP02.phx.gbl...
    > ??>> Hello, Andreas!
    > ??>>
    > ??>> what error do you get?
    > ??>>
    > ??>> Have a look at (
    > ??>> http://msdn2.microsoft.com/en-us/library/ms730167.aspx ) to known
    > more
    > ??>> about how to handle inheritance in data contracts You wrote on Thu,
    > ??>> 14 Dec 2006 13:55:13 +0100:
    > AH>>> Im trying out WCF for the first time and have hit a small snag. In
    > my
    > AH>>> project I have a class called Passenger which simplified look like
    > ??>> this
    > ??>>
    > AH>>> <DataContract> _
    > AH>>> Public Class Passenger
    > ??>>
    > AH>>> <DebuggerBrowsable(DebuggerBrowsableState.Never)> _
    > AH>>> Protected mAge As Integer = 0
    > ??>>
    > AH>>> <DataMember()> _
    > AH>>> Public Property Age() As Integer
    > AH>>> <DebuggerStepThrough()> _
    > AH>>> Get
    > AH>>> Return Me.mAge
    > AH>>> End Get
    > AH>>> <DebuggerStepThrough()> _
    > AH>>> Set(ByVal value As Integer)
    > AH>>> Me.mAge = value
    > AH>>> End Set
    > AH>>> End Property
    > ??>>
    > AH>>> End Class
    > ??>>
    > AH>>> I then have a strong type collection of Passengers with an
    > additional
    > AH>>> method
    > ??>>
    > AH>>> <DataContract()> _
    > AH>>> Public Class PassengerList
    > AH>>> Inherits List(Of Passenger)
    > ??>>
    > AH>>> Public Function FooBar() As Boolean
    > AH>>> ' Some code that doesn't matter
    > AH>>> End Function
    > ??>>
    > AH>>> End Class
    > ??>>
    > AH>>> The PassengerList object is then exposed through my service
    > contract.
    > AH>>> When I try to add a Service Reference in my client project I get an
    > AH>>> error. Now I assume
    > AH>>> this has to do that since the members of List(Of T) which I inherit
    > ??>> do
    > AH>>> not have the DataMember attribute added to its members (like the
    > AH>>> items). How is this kind of
    > AH>>> stuff done in a "Correct WFC way" ?
    > ??>>
    > AH>>> Thanks for your advice!
    > ??>>
    > ??>> With best regards, Vadym Stetsyak. E-mail: vadym_s@ukr.net
    > ??>>
    >
    > With best regards, Vadym Stetsyak. E-mail: vadym_s@ukr.net
    >



      My System SpecsSystem Spec

WFC and Inherited List problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
When a class is both an inherited class of another, and alsoimplements an interface method Curious .NET General 1 14 Aug 2009
Problem copying list of contacts into a new group list Terry Fenimore Vista mail 1 28 Feb 2009
Network List Service is missing from the list of services digital-flex Network & Sharing 2 06 May 2008
PS host and inherited timezone? Duncan Smith PowerShell 11 15 Jan 2008