Link to home
Start Free TrialLog in
Avatar of jagguy
jagguyFlag for Australia

asked on

slow wcf calls

I am using silverlight and WCF calls

My code works but it is slow. I am updating a field in a database table then i make another call to display the currect data to reflect the updated changes. The issue is on my PC there is about 1-2 for the update and new data to display.

 Public Sub webservice_updatedataPlus2Completed(ByVal sender As Object, ByVal e As ServiceReference1.updatedataPlus2CompletedEventArgs)
        If e.Result = True Then
            displayData()
        End If
    End Sub


<OperationContract()> _
        Public Function selectdata(ByVal getID As String) As List(Of sumResult)
        ' Public Function selectdata() As List(Of StudentInfo)
        Dim db2 As New trigB.Web.DataClasses1DataContext
        Dim mylist As New List(Of sumResult)
        'in the path it still says mathsTrainer1




        'what this does is get data from the database in results which is a list undeclared 'variant
        'with this list I populate each record into an existing class.


        Dim myresults = (From p In db2.sumResults _
                         Where p.id = getID _
                      Select p)

        If myresults.Count = 0 Then 'only bother if the user name exists which it will
            Dim temp As New sumResult
            temp.id = "wrong"
            mylist.Add(temp)

            Return mylist

        End If


        Return myresults.ToList



    End Function
    <OperationContract()> _
 Public Function updatedataPlus2(ByVal myid As String, ByVal sec As Integer) As Boolean
        Dim db2 As New trigB.Web.DataClasses1DataContext
        Dim temp As sumResult
        Dim mylist As New List(Of sumResult)


        'what this does is get data from the database in results which is a list undeclared 'variant
        'with this list I populate each record into an existing class.


        Dim myresults = (From p In db2.sumResults _
                        Where p.id = myid _
                        Select p)

        If myresults.Count > 0 Then 'only bother if the user name exists which it will
            For Each p As sumResult In myresults
                p.plus = p.plus + 1
                p.plusTime = p.plusTime + sec

            Next
            db2.SubmitChanges()

            Return True
        End If

        Return False

    End Function

Open in new window

Avatar of stuti16
stuti16

Please follow the link.

http://msdn.microsoft.com/en-us/library/aa751883.aspx

also you can

-- set useDefaultWebProxy=false on binding
-- disable wcf security if not required

Hope it will help.
Avatar of jagguy

ASKER

not big on reading WCF in MSDN for clairty.

where do i do the below
-- set useDefaultWebProxy=false on binding
-- disable wcf security if not required
ASKER CERTIFIED SOLUTION
Avatar of stuti16
stuti16

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial