1: // show this working with a second client by caching the context
2: private static void DemoThree()
3: {
4: Console.WriteLine("Press Enter to Send a Message (we'll cache the context and apply it to the new proxy)");
5: // Console.ReadLine();
6: Debugger.Break();
7: IWorkflowClient iwc = new IWorkflowClient(new NetTcpContextBinding(),
8: new EndpointAddress("net.tcp://localhost:10001/Intro1"));
9: IContextManager icm = iwc.InnerChannel.GetProperty<IContextManager>();
10: if (null != icm) Console.WriteLine("Context contains {0} elements", icm.GetContext().Count);
11: string s = iwc.Hello("message1");
12: Console.WriteLine("the service returned the message '{0}'", s);
13: CheckAndPrintContext(icm);
14: IDictionary<string, string> context = icm.GetContext();
15: icm = null;
16: iwc = new IWorkflowClient(new NetTcpContextBinding(),
17: new EndpointAddress("net.tcp://localhost:10001/Intro1"));
18: icm = iwc.InnerChannel.GetProperty<IContextManager>();
19: icm.SetContext(context);
20: s = iwc.Hello("message2");
21: Console.WriteLine("the service returned the message '{0}'", s);
22: icm = iwc.InnerChannel.GetProperty<IContextManager>();
23: CheckAndPrintContext(icm);
24: Console.WriteLine("Press Enter to Exit");
25:
26: }