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

Using namespaces in WCF service

Update your Vista Drivers Update Your Drivers Now!!
 
 
Thread Tools Display Modes
Old 05-07-2007   #1 (permalink)
StanB
Guest


 

Using namespaces in WCF service

Suppose I have this service:

================
namespace BillEntry
{
[ServiceContract(
Name = "BillEntryService",
Namespace = "http://BillEntry")]

interface IBillEntryService
{
[OperationContract]
void ProcessEntry (Employee[] list);
}

[DataContract(Namespace = "http://BillEntry")]
[KnownType(typeof(Manager))]
public class Employee
{
private int pk;
[DataMember]

public int Pk
{
get { return pk; }
set { pk = value; }
}
}

[DataContract(Namespace = "http://BillEntry")]
public class Manager : Employee
{
private int level;
public string Level
{
get { return level; }
set { level = value; }
}
}
}
=====================

I generate service proxy with 'n' option

/n:http://BillEntry, BillEntry

Two questions I don't understand here.

1. Why does svcutil generate TWO sets of Employee and Manager classes, one
set in the default namespace, second one in BillEntry namespace?

Second question is related to the first one, but this is where I stuck with
this:

One the client side, there are two sets of classes, in the default namespace
and in the BillEntry namespace, but ProcessEntry has Employee parameter
from BillEntry namespace

void ProcessEntry (BillEntry.Employee[] list)

so I have to create not Employee or Manager object but BillEntry.Employee
and BillEntry.Manager.

So far so good, everything compiles. However it fails on method call because
WCF expects
not 'BillEntry.Employee' but 'Employee'!


My first thought was to change [KnownType(typeof(Manager))]
to [KnownType(typeof(BillEntry.Manager))] but that didn't make any
difference

I don't know how can I fix this. I do need this 'BillEntry' namespace
generated by proxy so I can explicitly say 'BillEntry.Manager' versus just
'Manager', but I feel that I am doing something wrong here...

Another strange thing was that it was working fine, but then I changed
something in the service interface and svcutil began generating two sets of
classes, I had to change client code, it compiles, but blows up on this
method call....








My System SpecsSystem Spec
 

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Imported namespaces MCM .NET General 3 08-21-2008 09:54 PM
Creating a cmdlet using csc.exe - missing namespaces Marco Shaw PowerShell 5 10-03-2007 06:39 AM
Puzzled about namespaces Blip PowerShell 1 02-14-2007 11:53 AM
Binding, XPath & Namespaces Doug Avalon 4 01-10-2006 03:52 PM


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 51