🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.vbasic
1 messages
1 total messages Started by Grzegorz Piziak Mon, 09 Nov 2015 13:34
WCF Service Library - dlaczego tylko Async?
#105008
Author: Grzegorz Piziak
Date: Mon, 09 Nov 2015 13:34
68 lines
3059 bytes
Witam serdecznie,
utworzyłem WCF Service Library i podpiąłem jako referencje do projektu w tym samym Solution.

Mam dostęp do funkcji, ale tylko jako Async.

Kod WCF mam niezmieniony - wygenerowany przez VS2013.

Tylko taki mam dostęp do funkcji:

Dim sd As ServiceReference1.Service1Client = New ServiceReference1.Service1Client

        Dim r = Await sd.GetDataAsync(345)

Natomiast gdy uruchamiam z poziomy VS poniższy kod, to w "testerze" WCF mam również widoczną funkcję GetData() bez Async. Z czego to wynika? Czy nie przejmować się tym i pisać używając Async?

Dziękuję i pozdrawiam, Grzegorz.

---- KOD ----

Public Class Service1
    Implements IService1

    Public Sub New()
    End Sub

    Public Function GetData(ByVal value As Integer) As String Implements IService1.GetData
        Return String.Format("You entered: {0}", value)
    End Function

    Public Function GetDataUsingDataContract(ByVal composite As CompositeType) As CompositeType Implements IService1.GetDataUsingDataContract
        If composite Is Nothing Then
            Throw New ArgumentNullException("composite")
        End If
        If composite.BoolValue Then
            composite.StringValue &= "Suffix"
        End If
        Return composite
    End Function

End Class

----KOD Interfejsu ----

<ServiceContract()>
Public Interface IService1

    <OperationContract()>
    Function GetData(ByVal value As Integer) As String

    <OperationContract()>
    Function GetDataUsingDataContract(ByVal composite As CompositeType) As CompositeType

    ' TODO: Add your service operations here

End Interface

' Use a data contract as illustrated in the sample below to add composite types to service operations.

<DataContract()>
Public Class CompositeType

    <DataMember()>
    Public Property BoolValue() As Boolean

    <DataMember()>
    Public Property StringValue() As String

End Class
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads