Overloading di un Service Contract in WCF

Primi utilizzi... primi problemi... Sad

Stavo pubblicando il mio primo servizio con WCF è IIS mi ha detto:

“Cannot have two operations in the same contract with the same name [......]. You can change the name of one of the operations by changing the method name or by using the Name property of OperationContractAttribute.”

L’overloading rimane possibile... basta assegnare un nome differente nella parametrizzazione dell’attributo:

<ServiceContract()> _
Public Interface IMyCalculator
    <OperationContract(Name := "AddFloats")> _
    Function Add(ByVal operand1 As Single, ByVal operand2 As Single) As Single

    <OperationContract(Name := "AddIntegers")> _
    Function Add(ByVal operand1 As Integer, ByVal operand2 As Integer) As Integer
End Interface

Sarà ancora riferirsi a entrambi i metodi con Add. Solo nel WSDL si vedranno i diversi nomi.

Grazie a MSDN Forum.

posted @ domenica 5 ottobre 2008 19.15

Print

Comments on this entry:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
 
Please add 6 and 5 and type the answer here:
 

Live Comment Preview:

 
«febbraio»
domlunmarmergiovensab
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910