Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Indigo

WFC and Inherited List

 
 
Thread Tools Display Modes
Old 12-14-2006   #1 (permalink)
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


Old 12-15-2006   #2 (permalink)
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


Old 12-18-2006   #3 (permalink)
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
>



Old 12-18-2006   #4 (permalink)
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


Old 12-18-2006   #5 (permalink)
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
>



 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
add my contact list to safe senders list joha Vista mail 1 06-17-2008 11:13 AM
converting email list to mailing list Duane .NET General 1 05-13-2008 12:02 AM
Network List Service is missing from the list of services digital-flex Network & Internet 2 05-06-2008 04:21 PM
PS host and inherited timezone? Duncan Smith PowerShell 11 01-15-2008 05:54 AM
How to get a list of PropertyName from the format-list cmdlet? Dung K Hoang PowerShell 4 10-07-2006 07:51 AM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50