Skip to content

Dynamic Client Overview

tylerje edited this page Oct 23, 2014 · 1 revision

ServiceWire does not require that you generate client proxy code. It is done at run time. It is very fast. The dynamic assembly generated by evaluating the interface and emitting the intermediate language (IL) code directly is generally only done once in your client process, making subsequent use of the dynamic client, as seen below, even faster. For a client process that creates multiple clients on multiple threads concurrently, more than one dynamic assembly may be created. These are pooled and utilized in a thread safe manner in order to avoid creating large numbers of dynamic in-memory assemblies which are not unloaded until the process exits.

What you see when you use it:

 using (var client = new TcpClient<IMyService>(ipEndpoint))
 {
     var id = client.GetId("test1", 3.314, 42);
     int q2 = 4;
     var response = client.Get(id, "mirror", 4.123, out q2)
     var list = client.GetItems(id, new int[] { 3, 6, 9 });
 }

Visit the code to see the engine behind the dynamic proxy.

Clone this wiki locally