Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15785

Trying to use a service and service list only once.

$
0
0
Hi , I have multiple services that are called like:
Dim m_client As ServiceReference1.DataServiceClient
and a list that is called like:
Dim copyerlist As List(Of ServiceReference1.copyer)

I have multiple servers so in each on I have this service.
Now If I need to initialize the service I'm forced to do a case an initialize the service and the list like so:

Code:

    Select Case ServerLocation
 Case "192.168.1"
  m_client = New ServiceReference1.DataServiceClient
    copyerlist1 = New List(Of ServiceReference1.copyer)
 Case "192.168.2"
 m_client1 = New ServiceReference2.DataServiceClient
    copyerlist1 = New List(Of ServiceReference2.copyer)
...etc

I was wondering if there is any other way so I can have only one service and list to use after the initialization? Maybe with Ienumerable?
The above does not work but I'm trying to explain better on what I would like to have:
Just for the list, for, example
Code:

  Dim copyerlistGlobal As IEnumerable(Of copyer)
case ...etc
case1
 copyerlistGlobal = New List(Of ServiceReference1.copyer)
case2
 copyerlistGlobal = New List(Of ServiceReference2.copyer)

...etc

Any thoughts?


Thanks.

Edit.
My service function is this (deeply apologize for the c#):
public string xcop(List<copyer> inputCommands, bool overwr, string pass)

will it make any difference if I change this to
public string xcop(IEnumerable<copyer> inputCommands, bool overwr, string pass)
and try the above calls?

edit2.
Hmm also the services would be of the exact same class that I put in listof(), using it in the local program (aka recreating the exact class of copyer from the WCF service) does not pass along. It will probably not work if i try to pass another similar copyer from another service reference but I have currently only one service set up so I can't try that right away.

Viewing all articles
Browse latest Browse all 15785

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>