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 22:15

Print
Comments have been closed on this topic.
«luglio»
domlunmarmergiovensab
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910