svcutil.exe - SvcUtil not generating abstract classes in the client proxy (WCF) -


itemprop = "text">

I have defined

as classes in my service
  [DataContract] [ KnownType (typeof (MyConcrete1))] [known type (Taipf (Maikonkt 2))] public abstract class MyAbstract {[Datamember] public Int Absent get {; Set; }} [DataContract] Public Category MyConcrete1: MyAbstract {[Datamember] Public Inc. Concrete1Int {get; Set; }} [DataContract] Public Category MyConcrete2: MyAbstract {[Datamember] Public Inc. Concrete2Int {get; Set; }}  

And in my service, I have it

use
  [ServiceContract] public interface IService1 {[OperationContract] MyAbstract TestAbstract (MyAbstract value ); }  

As you can see, the method TestAbstract takes and abstract parameters MyAbstract gives, but customer SvcUtil, type " MyAbstract Em proxy generated by" <> Not intangible ! It generates a solid square.

  [Sistmkdaygnostikskdebuggerstepthroughttribute ()] [Sistmkkodedomkkmpailrkgenertedcodttrybute ( "Sistmkruntimeksserializtion", "3.0.0.0")] [Sistmkruntimeksserializtion. DataContractAttribute (name = "MyAbstract", namespace = "http://schemas.datacontract.org/2004/07/WcfService")] [System.Runtime.Serialization.KnownTypeAttribute (Taipf (WcfService.MyConcrete1))] [System.Runtime .Serialization.KnownTypeAttribute (typeof (WcfService.MyConcrete2))] public partial class MyAbstract: object, System.Runtime.Serialization.IExtensibleDataObject {private System.Runtime.Serialization.ExtensionDataObject extensionDataField; Private Industries AbsIntField; Public system.Rantim. Serialization. ExtensionDataObestStateStatusDate {Receive} this return. Extension Datasheet; } Set {this.extensionDataField = value; }} [System.Runtime.Serialization.DataMemberAttribute ()] Public Inc. AbsInt {get this.AbsIntField; } Set {this.AbsIntField = value; }}}  

How can I force svcUtil to generate MyAbstract as an abstract class? I'm stuck, please help ...

you can not - svcutil can not know That is myabstract class abstract. The metadata that is being exchanged between the server and the client does not support such a concept. SOA world oo does not always support everything in the world.

Service metadata only knows about things like services, method calls and data contracts - nothing is part of the service metadata

You add some extra logic and tweaking to the client code It is necessary, once it is making, if it is a real requirement in your favor.

Mark


Comments