/// <summary> /// Copy the values from the specified incubator to the current; the same as CombineWith /// </summary> /// <param name="incubator">The incubator to copy from</param> /// <param name="overwrite">If true, values in the current incubator /// will be over written by values of the same types from the specified /// incubator otherwise the current value will be kept</param> public void CopyFrom(Incubator incubator, bool overwrite = true) { lock (_accessLock) { foreach (Type t in incubator._typeInstanceDictionary.Keys) { if (!this._typeInstanceDictionary.ContainsKey(t) || overwrite) { this._typeInstanceDictionary[t] = incubator._typeInstanceDictionary[t]; } } foreach (string s in incubator._classNameTypeDictionary.Keys) { if (!this._classNameTypeDictionary.ContainsKey(s) || overwrite) { this._classNameTypeDictionary[s] = incubator._classNameTypeDictionary[s]; } } } }
public Incubator Clone() { lock (_accessLock) { Incubator val = new Incubator(); foreach (Type t in _typeInstanceDictionary.Keys) { val._typeInstanceDictionary.Add(t, _typeInstanceDictionary[t]); } foreach (string s in _classNameTypeDictionary.Keys) { val._classNameTypeDictionary.Add(s, _classNameTypeDictionary[s]); } foreach (Type type in _ctorParams.Keys) { val._ctorParams.Add(type, _ctorParams[type]); } return(val); } }
public FluentCtorContext(Incubator inc, string parametrerName) { Incubator = inc; ParameterName = parametrerName; }
/// <summary> /// Bind the specified type I ( same as AskingFor ) /// </summary> /// <typeparam name="I"></typeparam> /// <param name="incubator"></param> /// <returns></returns> public static FluentIncubationContext <I> Bind <I>(this Incubator incubator) { return(new FluentIncubationContext <I>(incubator)); }
public static FluentCtorContext <I> ForCtor <I>(this Incubator incubator, string parameterName) { return(new FluentCtorContext <I>(incubator, parameterName)); }
/// <summary> /// Bind the specified type I ( same as Bind ) /// </summary> /// <typeparam name="I"></typeparam> /// <param name="incubator"></param> /// <returns></returns> public static FluentIncubationContext <I> AskingFor <I>(this Incubator incubator) { return(new FluentIncubationContext <I>(incubator)); }
/// <summary> /// Copy the values from the specified incubator to the current; the same as CopyFrom /// </summary> /// <param name="incubator">The incubator to copy from</param> /// <param name="overwrite">If true, values in the current incubator /// will be over written by values of the same types from the specified /// incubator otherwise the current value will be kept</param> public void CombineWith(Incubator incubator, bool overwrite = true) { CopyFrom(incubator, overwrite); }
//Dictionary<Type, ConstructorInfo> implementations; static Incubator() { Default = new Incubator(); }
public FluentIncubationContext(Incubator incubator) { this.Incubator = incubator; }