![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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 Specs![]() |
| 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 |