public void AddCReg(IEnumerable<KeyAndType> asTypes, bool preserveExistingDefaults, ICReg registration) { foreach (var asType in asTypes) { AddCReg(asType, preserveExistingDefaults, registration); } }
public void Add(ICReg reg, bool preserveExistingDefaults) { if (!preserveExistingDefaults || _regs.Count == 0) { _chosenOne = reg; } _regs.Add(reg); }
public void PushToCycleDetector(ICReg reg, string name) { if (_cycleDetectionStack.Any(t => t.Item1 == reg)) { throw new InvalidOperationException("Cycle detected in registrations: " + string.Join(", ", _cycleDetectionStack.Select(t => t.Item2)) + ". Consider using Lazy<> to break cycle."); } _cycleDetectionStack.Push(new Tuple <ICReg, string>(reg, name)); }
void AddCReg(KeyAndType asType, bool preserveExistingDefaults, ICReg registration) { ICReg currentReg; if (!_registrations.TryGetValue(asType, out currentReg)) { _registrations.Add(asType, registration); return; } var multi = currentReg as ICRegMulti; if (multi != null) { multi.Add(registration, preserveExistingDefaults); return; } multi = new CRegMulti(); multi.Add(currentReg, false); multi.Add(registration, preserveExistingDefaults); _registrations[asType] = multi; }
public void Add(ICReg reg, bool preserveExistingDefaults) { if (!preserveExistingDefaults || _regs.Count == 0) _chosenOne = reg; _regs.Add(reg); }
public void Add(ICReg key, IILLocal local) { _map.Add(key, local); }
internal IILLocal?Get(ICReg key) { return(_map.TryGetValue(key, out var result) ? result : null); }
public void AddCReg(IEnumerable <KeyAndType> asTypes, bool preserveExistingDefaults, ICReg registration) { foreach (var asType in asTypes) { AddCReg(asType, preserveExistingDefaults, registration); } }
internal IILLocal Get(ICReg key) { IILLocal result; return _map.TryGetValue(key, out result) ? result : null; }
internal IILLocal Get(ICReg key) { IILLocal result; return(_map.TryGetValue(key, out result) ? result : null); }