/// <summary> /// Attempts to add a lifetime object container created by the 'factory' for the specified key /// </summary> /// <typeparam name="TKey">The type that will be used as a key</typeparam> /// <param name="objType">The type of the object that will be held by the lifetime container</param> /// <param name="factory">Factory to create a lifetime container for the sepcified 'objType'</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 bool TryAddAssociation <TKey>(Type objType, Lifetime.Factories.LifetimeFactory factory) { Contract.Requires <ArgumentNullException>(objType != null); Contract.Requires <ArgumentNullException>(factory != null); return(base.TryAddAssociation(typeof(TKey), objType, factory)); }
protected override bool TryAddAssociationInner(T key, Type objType, Lifetime.Factories.LifetimeFactory val) { Contract.Requires((object)key != null); Contract.Requires(objType != null); Contract.Requires(val != null); throw new NotImplementedException(); }
public bool TryAddAssociation(T key, Type objType, Lifetime.Factories.LifetimeFactory factory) { Contract.Requires <ArgumentNullException>((object)key != null); Contract.Requires <ArgumentNullException>(objType != null); Contract.Requires <ArgumentNullException>(factory != null); throw new NotImplementedException(); }
protected override bool TryAddAssociationInner(T key, Type objType, Lifetime.Factories.LifetimeFactory val) { TurboContract.Requires(key != null, conditionString: "key != null"); TurboContract.Requires(objType != null, conditionString: "objType != null"); TurboContract.Requires(val != null, conditionString: "val != null"); throw new NotImplementedException(); }
public bool TryAddAssociation(T key, Type objType, Lifetime.Factories.LifetimeFactory factory) { TurboContract.Requires(key != null); TurboContract.Requires(objType != null); TurboContract.Requires(factory != null); throw new NotImplementedException(); }
/// <summary> /// Adds a new association to the container /// </summary> /// <param name="key">Key</param> /// <param name="objType">The type of the object that will be held by the lifetime container</param> /// <param name="val">Factory to create a lifetime container for the sepcified 'objType'</param> protected sealed override void AddAssociationInner(TKey key, Type objType, Lifetime.Factories.LifetimeFactory val) { var lfInf = ProduceResolveInfo(key, objType, val); if (!_storage.TryAdd(key, lfInf)) { throw new ItemAlreadyExistsException(string.Format("AssociationContainer already contains the association for the key ({0})", key)); } }
protected override LifetimeBase ProduceResolveInfo(T key, Type objType, Lifetime.Factories.LifetimeFactory val) { Contract.Requires((object)key != null); Contract.Requires(objType != null); Contract.Requires(val != null); Contract.Ensures(Contract.Result <LifetimeBase>() != null); throw new NotImplementedException(); }
protected override LifetimeBase ProduceResolveInfo(T key, Type objType, Lifetime.Factories.LifetimeFactory val) { TurboContract.Requires(key != null, conditionString: "key != null"); TurboContract.Requires(objType != null, conditionString: "objType != null"); TurboContract.Requires(val != null, conditionString: "val != null"); TurboContract.Ensures(TurboContract.Result <LifetimeBase>() != null); throw new NotImplementedException(); }
/// <summary> /// Attempts to add a lifetime object container created by the 'factory' for the specified k /// </summary> /// <typeparam name="TKey">The type that will be used as a key</typeparam> /// <typeparam name="TValue">The type of the object that will be held by the lifetime container</typeparam> /// <param name="factory">Factory to create a lifetime container for the sepcified 'objType'</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 bool TryAddAssociation <TKey, TValue>(Lifetime.Factories.LifetimeFactory factory) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } return(base.TryAddAssociation(typeof(TKey), typeof(TValue), factory)); }
/// <summary> /// Adds a new association to the container /// </summary> /// <param name="key">Key</param> /// <param name="objType">The type of the object that will be held by the lifetime container</param> /// <param name="val">Factory to create a lifetime container for the sepcified 'objType'</param> protected sealed override void AddAssociationInner(TKey key, Type objType, Lifetime.Factories.LifetimeFactory val) { TurboContract.Requires(key != null, conditionString: "key != null"); TurboContract.Requires(objType != null, conditionString: "objType != null"); TurboContract.Requires(val != null, conditionString: "val != null"); var lfInf = ProduceResolveInfo(key, objType, val); if (!_storage.TryAdd(key, lfInf)) { throw new ItemAlreadyExistsException(string.Format("AssociationContainer already contains the association for the key ({0})", key)); } }
/// <summary> /// Attempts to add a lifetime object container created by the 'factory' for the specified key /// </summary> /// <typeparam name="TKey">The type that will be used as a key</typeparam> /// <param name="objType">The type of the object that will be held by the lifetime container</param> /// <param name="factory">Factory to create a lifetime container for the sepcified 'objType'</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 bool TryAddAssociation <TKey>(Type objType, Lifetime.Factories.LifetimeFactory factory) { if (objType == null) { throw new ArgumentNullException(nameof(objType)); } if (factory == null) { throw new ArgumentNullException(nameof(factory)); } return(base.TryAddAssociation(typeof(TKey), objType, factory)); }
/// <summary> /// Adds a lifetime object container created by the 'factory' for the specified key /// </summary> /// <param name="key">Key</param> /// <param name="objType">The type of the object that will be held by the lifetime container</param> /// <param name="factory">Factory to create a lifetime container for the sepcified 'objType'</param> public new void AddAssociation(Type key, Type objType, Lifetime.Factories.LifetimeFactory factory) { if (key == null) { throw new ArgumentNullException(nameof(key)); } if (objType == null) { throw new ArgumentNullException(nameof(objType)); } if (factory == null) { throw new ArgumentNullException(nameof(factory)); } base.AddAssociation(key, objType, factory); }
/// <summary> /// Attempts to add a lifetime object container created by the 'factory' 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 lifetime container</param> /// <param name="factory">Factory to create a lifetime container for the sepcified 'objType'</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 TryAddAssociation <TSrc>(this ICustomAssociationSupport <Type> obj, Type objType, Lifetime.Factories.LifetimeFactory factory) { Contract.Requires(obj != null); Contract.Requires <ArgumentNullException>(objType != null); Contract.Requires <ArgumentNullException>(factory != null); return(obj.TryAddAssociation(typeof(TSrc), objType, factory)); }
/// <summary> /// Adds a lifetime object container created by the 'factory' for the specified key /// </summary> /// <typeparam name="TKey">The type that will be used as a key</typeparam> /// <typeparam name="TValue">The type of the object that will be held by the lifetime container</typeparam> /// <param name="factory">Factory to create a lifetime container for the sepcified 'objType'</param> public void AddAssociation <TKey, TValue>(Lifetime.Factories.LifetimeFactory factory) { Contract.Requires <ArgumentNullException>(factory != null); base.AddAssociation(typeof(TKey), typeof(TValue), factory); }
/// <summary> /// Creates a lifetime container by object type and lifetime factory /// </summary> /// <param name="key">The key that will be used to store lifetime container inside the current AssociationContainer</param> /// <param name="objType">The type of the object that will be held by the lifetime container</param> /// <param name="val">Factory to create a lifetime container for the sepcified 'objType'</param> /// <returns>Created lifetime container</returns> protected abstract LifetimeBase ProduceResolveInfo(TKey key, Type objType, Lifetime.Factories.LifetimeFactory val);
/// <summary> /// Attempts to add a new association to the container /// </summary> /// <param name="key">Key</param> /// <param name="objType">The type of the object that will be held by the lifetime container</param> /// <param name="val">Factory to create a lifetime container for the sepcified 'objType'</param> /// <returns>True if AssociationContainer not contains lifetime container with the same key; overwise false</returns> protected sealed override bool TryAddAssociationInner(TKey key, Type objType, Lifetime.Factories.LifetimeFactory val) { TurboContract.Requires(key != null, conditionString: "key != null"); TurboContract.Requires(objType != null, conditionString: "objType != null"); TurboContract.Requires(val != null, conditionString: "val != null"); if (_storage.ContainsKey(key)) { return(false); } var lfInf = ProduceResolveInfo(key, objType, val); return(_storage.TryAdd(key, lfInf)); }
protected override LifetimeBase ProduceResolveInfo(T key, Type objType, Lifetime.Factories.LifetimeFactory val) { throw new NotImplementedException(); }
/// <summary> /// Attempts to add a lifetime object container created by the 'factory' for the specified key /// </summary> /// <param name="key">Key</param> /// <param name="objType">The type of the object that will be held by the lifetime container</param> /// <param name="factory">Factory to create a lifetime container for the sepcified 'objType'</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 new bool TryAddAssociation(Type key, Type objType, Lifetime.Factories.LifetimeFactory factory) { return(base.TryAddAssociation(key, objType, factory)); }
/// <summary> /// Attempts to add a lifetime object container created by the 'factory' 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 lifetime container</param> /// <param name="factory">Factory to create a lifetime container for the sepcified 'objType'</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 TryAddAssociation <TSrc>(this ICustomAssociationSupport <Type> obj, Type objType, Lifetime.Factories.LifetimeFactory factory) { TurboContract.Requires(obj != null, conditionString: "obj != null"); TurboContract.Requires(objType != null, conditionString: "objType != null"); TurboContract.Requires(factory != null, conditionString: "factory != null"); return(obj.TryAddAssociation(typeof(TSrc), objType, factory)); }
/// <summary> /// Attempts to add a lifetime object container created by the 'factory' for the specified k /// </summary> /// <typeparam name="TKey">The type that will be used as a key</typeparam> /// <typeparam name="TValue">The type of the object that will be held by the lifetime container</typeparam> /// <param name="factory">Factory to create a lifetime container for the sepcified 'objType'</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 bool TryAddAssociation <TKey, TValue>(Lifetime.Factories.LifetimeFactory factory) { Contract.Requires <ArgumentNullException>(factory != null); return(base.TryAddAssociation(typeof(TKey), typeof(TValue), factory)); }
/// <summary> /// Adds a lifetime object container created by the 'factory' for the specified key /// </summary> /// <param name="key">Key</param> /// <param name="objType">The type of the object that will be held by the lifetime container</param> /// <param name="factory">Factory to create a lifetime container for the sepcified 'objType'</param> public new void AddAssociation(Type key, Type objType, Lifetime.Factories.LifetimeFactory factory) { base.AddAssociation(key, objType, factory); }
/// <summary> /// Attempts to add a new association to the container /// </summary> /// <param name="key">Key</param> /// <param name="objType">The type of the object that will be held by the lifetime container</param> /// <param name="val">Factory to create a lifetime container for the sepcified 'objType'</param> /// <returns>True if AssociationContainer not contains lifetime container with the same key; overwise false</returns> protected sealed override bool TryAddAssociationInner(TKey key, Type objType, Lifetime.Factories.LifetimeFactory val) { if (_storage.ContainsKey(key)) { return(false); } var lfInf = ProduceResolveInfo(key, objType, val); return(_storage.TryAdd(key, lfInf)); }