views:

572

answers:

1

How can I get WCF to allow the following?

Dim EmployeeID as Integer = 10
Dim emp As New WcfServiceLibrary1.Employee(EmployeeID)
Response.write (emp.LastName)

Currently I have to do this because I can't figure out a way for WCF to allow for Parameterized Constructors:

Dim EmployeeID as Integer = 10
Dim emp As New WcfServiceLibrary1.Employee()
emp = emp.GetEmployee(EmployeeID)
Response.write (emp.LastName)

It just seems weird that I would have to take this extra step.

+2  A: 

you are using a constructor to create an instance of a service class which is different from a normal class, Also, here WCF is handling object marshaling. you wont be able to do what you are trying to achieve using a service contract.

Perpetualcoder