WCF Complex types

Jun 29 2010 12:05 PM
Hi everybody!
 
Im trying to expose some complex types into a WCF Web Service and i have this scenario:
I have 2 classes one inherits from another
Class 1:

Imports System.Web.Services
Imports System.ServiceModel
Imports System.Runtime.Serialization

<DataContract()> _
Public MustInherit Class ImpresiĆ³n

    Private _poliza As String

    <DataMember()> _
    Public Property Valor1() As String

        Get
           Return _valor1
        End Get

        Set(ByVal value As String)
           _valor1= value
        End Set

    End Property
    <DataContract()> <Flags()> _
    Public Enum ETipoDocumento
        ArregloBytes
       URL
    End Enum

End Class
 

Class 2:

Imports System.Web.Services
Imports System.ServiceModel
Imports System.Runtime.Serialization

<DataContract()> _
Public Class Impresion2
  Inherits Impresion

    Private _numeroCopias As String
    <DataMember()> _
    Public Property NumeroCopias() As Integer

        Get
           Return _numeroCopias
        End Get

        Set(ByVal value As Integer)
            _numeroCopias = value
        End Set

    End Property
    <DataMember()> _
    Public ReadOnly Property TipoDocumento() As String

        Get
            Return ETipoDocumento.ArregloBytes
        End Get

    End Property
End Class

 
As you can see i have 2 classes and the second one inherits from the first one.
What i want to do is expose that classes as Complex Types into a WCF Service, so any client that references it can see and use the implementation of the complex types.
I have to mention that the classes are in separate files and projects
 
Heres my problem. I need a way to expose a class into a WCF Service like it where a native type so i can instanciate it anywhere by only adding the reference.
This is what i want to achieve:

Dim myVar as new ServiceReference.Impresion2()
myVar.NumeroCopias = 1

In C#
Servicereference.Impresion2 myVar = new ServiceReference.Impresion2();
myVar.NumeroCopias = 1;

Did i make myself undesrtand?