public async Task CreateContextScopeContainerAndUseInAsyncSenario()
        {
            result = "....";
            using (var scopeManager = RequestResponseScopefactory.CreateScope())
            {
                var runtime = RuntimeFactory.CreateRuntime();
                Assert.AreEqual(scopeManager.ContextId, runtime.InstanceId);
                var value = await DoSomethingAsync("Meshuggah");

                Assert.AreEqual("Meshuggah", value);
            }
            Assert.AreEqual("Meshuggah", result);
            using (var scopeManager = RequestResponseScopefactory.CreateScope())
            {
                using (var t = TracerFactory.StartTracer(this, "CreateContextScopeContainerAndUseInAsyncSenario"))
                {
                    var runtime = RuntimeFactory.CreateRuntime();
                    Assert.AreEqual(scopeManager.ContextId, runtime.InstanceId);
                    var value = await DoSomethingAsync("Iron Maiden");

                    Assert.AreEqual("Iron Maiden", value);
                    Console.WriteLine(t.GetCallstack().Serialize(forceSerializationAnyway: true));
                }
            }
            Assert.AreNotEqual("Meshuggah", result);
        }
 public async Task CreateContextScopeContainer()
 {
     using (var scopeManager = RequestResponseScopefactory.CreateScope())
     {
         var runtime = RuntimeFactory.CreateRuntime();
         Assert.AreEqual(scopeManager.ContextId, runtime.InstanceId);
     }
 }
示例#3
0
 public void Initialize()
 {
     KernelScope = Resolver.BeginKernelScope();
     Resolver.LoadModuleConfiguration <Blueprint>();
     Scope = RequestResponseScopefactory.CreateScope();
 }