public DisposeBehavior SetDisposeBehavior(DisposeBehavior behavior) { VerifyDisposure(); lock (GeneralLock) { return(DisposeBehaviorConfig = behavior); } }
public Binding(BindingMetadata bindingMetadata, Expression expression, Lifetime lifetime = Lifetime.Transient, Action <object>?finalizer = null, DisposeBehavior needsDispose = DisposeBehavior.Default) { BindingMetadata = bindingMetadata ?? throw new ArgumentNullException(nameof(bindingMetadata)); Lifetime = lifetime; Expression = expression ?? throw new ArgumentNullException(nameof(expression)); NeedsDispose = needsDispose; Finalizer = finalizer; }
/// <summary> /// Controls if and when the instance should be disposed. <see cref="DisposeBehavior"/> for more detailed information. /// </summary> /// <param name="value"></param> /// <returns></returns> public WeaklyTypedServiceConfigurator With(DisposeBehavior value) { if (!EnumMetadata <DisposeBehavior> .IsValidValue(value)) { throw new InvalidEnumValue <DisposeBehavior>(value); } _disposeBehavior = value; return(this); }
/// <summary> /// Controls if and when the instance should be disposed. <see cref="DisposeBehavior"/> for more detailed information. /// </summary> /// <param name="value"></param> /// <returns></returns> public StronglyTypedServiceConfigurator <TDependency, TInstance> With(DisposeBehavior value) { if (!EnumMetadata <DisposeBehavior> .IsValidValue(value)) { throw new InvalidEnumValue <DisposeBehavior>(value); } _disposeBehavior = value; return(this); }
public ServiceBinding(SinglyLinkedListNode <Type> serviceTypes, BindingMetadata bindingMetadata, Expression expression, Lifetime lifetime = Lifetime.Transient, Action <object>?finalizer = null, DisposeBehavior needsDispose = DisposeBehavior.Default) { ServiceTypes = serviceTypes ?? throw new ArgumentNullException(nameof(serviceTypes)); BindingMetadata = bindingMetadata ?? throw new ArgumentNullException(nameof(bindingMetadata)); Lifetime = !EnumMetadata <Lifetime> .IsValidValue(lifetime) ? throw new InvalidEnumValueException <Lifetime>(lifetime) : lifetime; Expression = expression ?? throw new ArgumentNullException(nameof(expression)); NeedsDispose = !EnumMetadata <DisposeBehavior> .IsValidValue(needsDispose) ? throw new InvalidEnumValueException <DisposeBehavior>(needsDispose) : needsDispose; Finalizer = finalizer; }
/// <summary> /// Controls if and when the instance should be disposed. <see cref="DisposeBehavior"/> for more detailed information. /// </summary> /// <param name="value"></param> /// <returns></returns> public StronglyTypedServiceConfigurator <TDependency, TInstance> With(DisposeBehavior value) { _disposeBehavior = value; return(this); }
/// <summary> /// Controls if and when the instance should be disposed. <see cref="DisposeBehavior"/> for more detailed information. /// </summary> /// <param name="value"></param> /// <returns></returns> public WeaklyTypedServiceConfigurator With(DisposeBehavior value) { _disposeBehavior = value; return(this); }
public ServiceBinding(Type dependencyType, BindingMetadata bindingMetadata, Expression expression, Lifetime lifetime = Lifetime.Transient, Action <object>?finalizer = null, DisposeBehavior needsDispose = DisposeBehavior.Default) : this(new SinglyLinkedListNode <Type>(dependencyType), bindingMetadata, expression, lifetime, finalizer, needsDispose) { }