🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.vbasic
Article #105008

WCF Service Library - dlaczego tylko Async?

#105008
From: 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
Technical Details
Message-ID: <e7a27e99-7a23-4df5-bb70-374f1934a15a@googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!news.glorb.com!i2no1122595igv.0!news-out.google.com!fs1ni3939igb.0!nntp.google.com!i2no1122591igv.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Received: by 10.66.190.163 with SMTP id gr3mr24327290pac.45.1447076091169;        Mon, 09 Nov 2015 05:34:51 -0800 (PST)
X-Received: by 10.182.50.225 with SMTP id f1mr315633obo.11.1447076091131; Mon, 09 Nov 2015 05:34:51 -0800 (PST)
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!news.glorb.com!i2no1122595igv.0!news-out.google.com!fs1ni3939igb.0!nntp.google.com!i2no1122591igv.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: pl.comp.lang.vbasic
Date: Mon, 9 Nov 2015 05:34:50 -0800 (PST)
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=217.173.195.250; posting-account=9x_bbQoAAADsBHimj8merfooOc7QCErg
NNTP-Posting-Host: 217.173.195.250
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e7a27e99-7a23-4df5-bb70-374f1934a15a@googlegroups.com>
Subject: WCF Service Library - dlaczego tylko Async?
From: Grzegorz Piziak <gpiziak@gmail.com>
Injection-Date: Mon, 09 Nov 2015 13:34:51 +0000
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit