コード例 #1
0
 void DisposeScope(IJob job, ILifetimeScope lifetimeScope)
 {
     if (_logger.IsDebugEnabled)
     {
         _logger.Info($"Disposing Scope 0x{ lifetimeScope?.GetHashCode() ?? 0:x} for Job 0x{job?.GetHashCode() ?? 0:x}");
     }
     lifetimeScope?.Dispose();
 }
コード例 #2
0
 static void DisposeScope(IJob job, ILifetimeScope lifetimeScope)
 {
     if (s_log.IsTraceEnabled)
     {
         s_log.TraceFormat("Disposing Scope 0x{0:x} for Job 0x{1:x}",
                           lifetimeScope?.GetHashCode() ?? 0,
                           job?.GetHashCode() ?? 0);
     }
     lifetimeScope?.Dispose();
 }
コード例 #3
0
        void DisposeScope(IJob job, ILifetimeScope lifetimeScope)
        {
            _logDebug(job, string.Format("Disposing Scope 0x{0:x} for Job 0x{1:x}",
                                         lifetimeScope != null ? lifetimeScope.GetHashCode() : 0,
                                         job != null ? job.GetHashCode() : 0));

            if (lifetimeScope != null)
            {
                lifetimeScope.Dispose();
            }
        }
コード例 #4
0
 public AutofacAdapter(ILifetimeScope container)
 {
     if (container == null)
     {
         LifetimeScope = new ContainerBuilder().Build();
     }
     else
     {
         LifetimeScope = container;
         Logger.Debug("Starting new lifetime scope {0}", LifetimeScope.GetHashCode());
     }
 }
コード例 #5
0
 private static void DisposeScope(IJob job, ILifetimeScope lifetimeScope)
 {
     if (s_log.IsDebugEnabled)
     {
         s_log.DebugFormat("Disposing Scope 0x{0:x} for Job 0x{1:x}",
                           lifetimeScope != null ? lifetimeScope.GetHashCode() : 0,
                           job != null ? job.GetHashCode() : 0);
     }
     if (lifetimeScope != null)
     {
         lifetimeScope.Dispose();
     }
 }
コード例 #6
0
        static void DisposeScope(IJob job, ILifetimeScope lifetimeScope)
        {
            if (SLog.IsTraceEnabled)
            {
                SLog.TraceFormat("Disposing Scope 0x{0:x} for Job 0x{1:x}",
                                 lifetimeScope == null ? 0 : lifetimeScope.GetHashCode(),
                                 job == null ? 0 : job.GetHashCode());
            }

            if (lifetimeScope != null)
            {
                lifetimeScope.Dispose();
            }
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: HuZeHua/InternetDemo
        private static void Method08()
        {
            string           tag     = "test";
            ContainerBuilder builder = new ContainerBuilder();

            builder.RegisterType <Program>().AsSelf().InstancePerLifetimeScope();//.InstancePerMatchingLifetimeScope(tag);
            IContainer     container = builder.Build();
            ILifetimeScope scope1    = container.BeginLifetimeScope(tag);

            Console.WriteLine(scope1.GetHashCode());
            Program p1 = scope1.Resolve <Program>();

            Console.WriteLine(p1.GetHashCode());
            p1 = scope1.Resolve <Program>();
            Console.WriteLine(p1.GetHashCode());
            ILifetimeScope scope2 = container.BeginLifetimeScope(tag);

            Console.WriteLine(scope2.GetHashCode());
            Program p2 = scope2.Resolve <Program>();

            Console.WriteLine(p2.GetHashCode());
            p2 = scope2.Resolve <Program>();
            Console.WriteLine(p2.GetHashCode());
        }
コード例 #8
0
      void DisposeScope(IJob job, ILifetimeScope lifetimeScope)
      {
          _logDebug(job, string.Format("Disposing Scope 0x{0:x} for Job 0x{1:x}",
              lifetimeScope != null ? lifetimeScope.GetHashCode() : 0,
              job != null ? job.GetHashCode() : 0));
 
          if (lifetimeScope != null)
              lifetimeScope.Dispose();
      }
コード例 #9
0
 private static void DisposeScope(IJob job, ILifetimeScope lifetimeScope)
 {
     if (s_log.IsDebugEnabled)
     {
         s_log.DebugFormat("Disposing Scope 0x{0:x} for Job 0x{1:x}",
             lifetimeScope != null ? lifetimeScope.GetHashCode() : 0,
             job != null ? job.GetHashCode() : 0);
     }
     if (lifetimeScope != null)
         lifetimeScope.Dispose();
 }
コード例 #10
0
 public override int GetHashCode()
 {
     return(LifetimeScope.GetHashCode());
 }