🚀 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 05:34
WCF Service Library - dlaczego tylko Async?
#102519
Author: Grzegorz Piziak
Date: Mon, 09 Nov 2015 05:34
75 lines
1939 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