Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First of all, you need to define an interface as a ServiceContract and the method that returns the Custom Collection as an OperationContract. I will give you the code in VB.net, bus is very very easy to translate it to c#</p> <pre><code>Imports System.ServiceModel &lt;ServiceContract()&gt; Public Interface IClientContract &lt;OperationContract()&gt; Function GetClientList() As IList(Of POCOClients) End Interface </code></pre> <p>Here, the IList(of POCOClients) is the custom collection. Then, implement the interface.</p> <pre><code>Public Class ClientContractImplementation Implements IClientContract Private ClientOp As IClientsOperations Sub New() 'I use a IoC container here, but you can make a standar New() at this point' ClientOp = BLIoC.Container.Resolve(Of IClientsOperations)() End Sub Public Function GetClientList() As System.Collections.Generic.IList(Of ServiceLayerContract.POCOClients) Implements ServiceLayerContract.IClientContract.GetClientList Return ClientOp.SearchClients() End Function End Class </code></pre> <p>And, then you need to configure the app.config to expose the WCF service, in the Service.ServiceModel section:</p> <p> </p> <pre><code>&lt;/endpoint&gt; &lt;endpoint address="mex" binding="mexHttpBinding" name="MEX" contract="IMetadataExchange"/&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="http://localhost:81/Client"/&gt; &lt;/baseAddresses&gt; &lt;/host&gt; </code></pre> <p></p> <p>Now, when a client calls to the service, a custom collection of IList(Of POCOClients) (or whatever you want) will be returned.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload