/// <summary> /// Attempts to add an object with per call lifetime for the specified key /// </summary> /// <typeparam name="TSrc">The type that will be used as a key</typeparam> /// <param name="obj">Association container to which the addition is performed</param> /// <param name="objType">The type of the object that will be held by the PerCall lifetime container</param> /// <returns>True if the association was added successfully (that is AssociationContainer did not contained lifetime container with the same key); overwise false</returns> public static bool TryAddPerCall <TSrc>(this IPerCallAssociationSupport <Type> obj, Type objType) { Contract.Requires(obj != null); Contract.Requires <ArgumentNullException>(objType != null); return(obj.TryAddPerCall(typeof(TSrc), objType)); }
/// <summary> /// Attempts to add an object with per call lifetime for the specified key /// </summary> /// <typeparam name="TSrc">The type that will be used as a key</typeparam> /// <param name="obj">Association container to which the addition is performed</param> /// <param name="objType">The type of the object that will be held by the PerCall lifetime container</param> /// <returns>True if the association was added successfully (that is AssociationContainer did not contained lifetime container with the same key); overwise false</returns> public static bool TryAddPerCall <TSrc>(this IPerCallAssociationSupport <Type> obj, Type objType) { TurboContract.Requires(obj != null, conditionString: "obj != null"); TurboContract.Requires(objType != null, conditionString: "objType != null"); return(obj.TryAddPerCall(typeof(TSrc), objType)); }
/// <summary> /// Adds an object with per call lifetime for the specified key /// </summary> /// <typeparam name="TSrc">The type that will be used as a key</typeparam> /// <typeparam name="TTarg">The type of the object that will be held by the PerCall lifetime container</typeparam> /// <param name="obj">Association container to which the addition is performed</param> public static void AddPerCall <TSrc, TTarg>(this IPerCallAssociationSupport <Type> obj) { Contract.Requires(obj != null); obj.AddPerCall(typeof(TSrc), typeof(TTarg)); }
/// <summary> /// Attempts to add an object with per call lifetime for the specified key /// </summary> /// <typeparam name="TSrc">The type that will be used as a key</typeparam> /// <typeparam name="TTarg">The type of the object that will be held by the PerCall lifetime container</typeparam> /// <param name="obj">Association container to which the addition is performed</param> /// <returns>True if the association was added successfully (that is AssociationContainer did not contained lifetime container with the same key); overwise false</returns> public static bool TryAddPerCall <TSrc, TTarg>(this IPerCallAssociationSupport <Type> obj) { Contract.Requires(obj != null); return(obj.TryAddPerCall(typeof(TSrc), typeof(TTarg))); }
/// <summary> /// Adds an object with per call lifetime for the specified key /// </summary> /// <typeparam name="TSrc">The type that will be used as a key</typeparam> /// <typeparam name="TTarg">The type of the object that will be held by the PerCall lifetime container</typeparam> /// <param name="obj">Association container to which the addition is performed</param> public static void AddPerCall <TSrc, TTarg>(this IPerCallAssociationSupport <Type> obj) { TurboContract.Requires(obj != null, conditionString: "obj != null"); obj.AddPerCall(typeof(TSrc), typeof(TTarg)); }