Naming Generic DataContracts in WCF

我只是一个虾纸丫 提交于 2019-11-28 20:29:50

Ok found the Answer

You can specify the Serialised version using the following syntax:

[DataContract(Name = "MyClassOf{0}{1}")]

class MyClass { }

So if I had a Class called Response which takes a Generic T parameter I would use

[DataContract(Name = "ResponseOfType{0}")]

class Response { }

Musa Doğramacı
[DataContract(Name = "ReturnObjectOfType{0}")]
    public class ReturnObject<T>
    {....

//Iservice
[OperationContract]
        ReturnObject<AdresKisiBilgi> BeldeAdresKisiBilgiSorgula(string tcKimlikNo);


//Service
public ReturnObject<HbysBusiness.MernisGuvenService.AdresKisiBilgi> BeldeAdresKisiBilgiSorgula(string tcKimlikNo)
        {
            return new MernisBiz().BeldeAdresKisiBilgiSorgula(tcKimlikNo);
        }


client:
 public ReturnObjectOfAdresKisiBilgi BeldeAdresKisiBilgiSorgula(string tcKimlikNo)
        {....

Thank you Harry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!