/// <inheritdoc /> public void AddDecorator(Type type, IServiceRegistration serviceRegistration, bool remap, bool replace) { var newRepository = new ArrayStoreKeyed <Type, IServiceRegistration>(serviceRegistration.ImplementationType, serviceRegistration); if (remap) { Swap.SwapValue(ref this.repository, repo => repo.AddOrUpdate(type, newRepository, (oldValue, newValue) => newValue)); } else { Swap.SwapValue(ref this.repository, repo => repo.AddOrUpdate(type, newRepository, (oldValue, newValue) => oldValue .AddOrUpdate(serviceRegistration.ImplementationType, serviceRegistration, replace))); } }
private void AddOrUpdateRegistration(ref AvlTreeKeyValue <Type, ArrayStoreKeyed <object, IServiceRegistration> > repository, IServiceRegistration registration, bool remap, bool replace) { var newRepository = new ArrayStoreKeyed <object, IServiceRegistration>(registration.RegistrationId, registration); if (remap) { Swap.SwapValue(ref repository, repo => repo.AddOrUpdate(registration.ServiceType, newRepository, (oldValue, newValue) => newValue)); } else { Swap.SwapValue(ref repository, repo => repo.AddOrUpdate(registration.ServiceType, newRepository, (oldValue, newValue) => oldValue.AddOrUpdate(registration.RegistrationId, registration, replace))); } }
/// <inheritdoc /> public void AddDecorator(Type type, IServiceRegistration serviceRegistration, bool remap, bool replace) { var newRepository = new ArrayStoreKeyed <Type, IServiceRegistration>(serviceRegistration.ImplementationType, serviceRegistration); if (remap) { Swap.SwapValue(ref this.repository, (t1, t2, t3, t4, repo) => repo.AddOrUpdate(t1, t2, (oldValue, newValue) => newValue), type, newRepository, Constants.DelegatePlaceholder, Constants.DelegatePlaceholder); } else { Swap.SwapValue(ref this.repository, (t1, t2, t3, t4, repo) => repo.AddOrUpdate(t1, t2, (oldValue, newValue) => oldValue .AddOrUpdate(t3.ImplementationType, t3, t4)), type, newRepository, serviceRegistration, replace); } }
private void AddOrUpdateRegistration(ref AvlTreeKeyValue <Type, ArrayStoreKeyed <object, IServiceRegistration> > repository, IServiceRegistration registration, Type serviceType, bool remap, bool replace) { var newRepository = new ArrayStoreKeyed <object, IServiceRegistration>(registration.RegistrationId, registration); if (remap) { Swap.SwapValue(ref repository, (t1, t2, t3, t4, repo) => repo.AddOrUpdate(t1, t2, true), serviceType, newRepository, Constants.DelegatePlaceholder, Constants.DelegatePlaceholder); } else { Swap.SwapValue(ref repository, (t1, t2, t3, t4, repo) => repo.AddOrUpdate(t2, t3, (oldValue, newValue) => oldValue.AddOrUpdate(t1.RegistrationId, t1, t4)), registration, serviceType, newRepository, replace); } }
private ResolutionContext(IResolutionScope scope, AvlTreeKeyValue <int, bool> circularDependencyBarrier, AvlTree <Expression> expressionOverrides, AvlTree <Type> currentlyDecoratingTypes, ArrayStore <ArrayStoreKeyed <bool, ParameterExpression> > parameterExpressions, ISet <object> scopeNames, IContainerContext childContext, bool nullResultAllowed, ParameterExpression currentScope, ArrayStoreKeyed <object, ParameterExpression> knownVariables) { this.DefinedVariables = ArrayStoreKeyed <object, ParameterExpression> .Empty; this.SingleInstructions = ArrayStore <Expression> .Empty; this.expressionOverrides = expressionOverrides; this.currentlyDecoratingTypes = currentlyDecoratingTypes; this.NullResultAllowed = nullResultAllowed; this.ResolutionScope = scope; this.RootScope = scope.RootScope; this.CurrentScopeParameter = currentScope; this.ParameterExpressions = parameterExpressions; this.ChildContext = childContext; this.ScopeNames = scopeNames; this.knownVariables = knownVariables; this.circularDependencyBarrier = circularDependencyBarrier; }
/// <summary> /// Adds a global variable to the compiled expression tree. /// </summary> /// <param name="parameter">The variable.</param> public void AddDefinedVariable(ParameterExpression parameter) => this.DefinedVariables = this.DefinedVariables.AddOrUpdate(parameter, parameter);
/// <summary> /// Adds a global keyed variable to the compiled expression tree. /// </summary> /// <param name="key">The key of the variable.</param> /// <param name="parameter">The variable.</param> public void AddDefinedVariable(object key, ParameterExpression parameter) => this.DefinedVariables = this.DefinedVariables.AddOrUpdate(key, parameter);