Summer.Batch.Core.Unity.StepScope.StepScopeLifetimeManager.SetValue C# (CSharp) Метод

SetValue() публичный Метод

Stores an object for the current step.
public SetValue ( object newValue ) : void
newValue object the object to store
Результат void
        public override void SetValue(object newValue)
        {
            if (!(newValue is IProxyObject))
            {
                Context.SetAttribute(_name, newValue);
                var disposable = newValue as IDisposable;
                if (disposable != null)
                {
                    StepSynchronizationManager.GetContext().RegisterDestructionCallback(_name, new Task(() =>
                    {
                        disposable.Dispose();
                    }));
                }
            }
        }

Usage Example

        public void TestSetValue3()
        {
            var obj1 = new object();
            var obj2 = new object();
            var manager = new StepScopeLifetimeManager();
            StepSynchronizationManager.Register(_stepExecution1);
            manager.SetValue(obj1);
            StepSynchronizationManager.Register(_stepExecution2);
            manager.SetValue(obj2);

            var result = manager.GetValue();

            Assert.AreEqual(obj2, result);
        }
All Usage Examples Of Summer.Batch.Core.Unity.StepScope.StepScopeLifetimeManager::SetValue
StepScopeLifetimeManager