Quantcast
Channel: WCF, ASMX and other Web Services
Viewing all articles
Browse latest Browse all 555

Sharing data contracts between wcf services without use ServiceReference name

$
0
0

Hi

icreated WCF service. My project name is SERVICE_ABC. In solution i created Service_A.svc, Service_B.svc, Service_C.svc and PersonelDTO.cs. All service using PersonelDTO.cs. Her is the code

public interface IService_A
{
[OperationContract]
void DoWork();

[OperationContract]
PersonelDTO GetMyData();
}

public interface IService_B
{
[OperationContract]
void DoWork();

[OperationContract]
PersonelDTO GetMyData();
}

public interface IService_C
{
[OperationContract]
void DoWork();

[OperationContract]
PersonelDTO GetMyData();
}

I read service WEB_ABC .net solution. In the HomeController.cs i have got Deneme() controller.  how can i use PersonelDTO  without ServiceReference_A service reference name

public string Deneme()
{
Service_AClient clientA = new Service_AClient();
Service_BClient clientB = new Service_BClient();
Service_CClient clientC = new Service_CClient();

/*Below these codes working properly
var DataA = clientA.GetMyData();
ServiceReference_B.PersonelDTO DataB = clientB.GetMyData();
ServiceReference_C.PersonelDTO DataC = clientC.GetMyData();
*/

//I want to use PersonelDTO without using ServiceReference_A service reference name
PersonelDTO DataA = clientA.GetMyData();
PersonelDTO DataB = clientB.GetMyData();
PersonelDTO DataC = clientC.GetMyData();

return "Ok";
}

Thanks. You can download project this link


Viewing all articles
Browse latest Browse all 555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>