예제 #1
0
 public virtual ScopedMap <TKey, TValue> Create(IMap <TKey, TValue> map, MapScope scope, string identifier)
 {
     return(new ScopedMap <TKey, TValue>(
                map,
                scope,
                identifier,
                CreateKeySerializer()));
 }
예제 #2
0
 public override ScopedMap <TKey, ISet <TValue> > Create(IMap <TKey, ISet <TValue> > map, MapScope scope, string identifier)
 {
     return(new ScopedSetMap <TKey, TValue>(
                (ISetMap <TKey, TValue>)map,
                scope,
                identifier,
                CreateKeySerializer(),
                RemoveOnEmptySet()));
 }
예제 #3
0
 /// <summary>
 /// Create a new instance of a previously mapped type
 ///
 /// Example:
 ///
 ///   var instance = default(Person).Resolve();
 ///
 /// </summary>
 /// <typeparam name="T">The type that was mapped</typeparam>
 /// <param name="self">Not used. Can be null</param>
 /// <returns>Instance of resolved type. If no mapped type, then T</returns>
 public static T Resolve <T>(this T self)
 {
     //Ignoring the "self" parameter. For simpler calling syntax.
     return(MapScope <T> .Resolve());
 }
예제 #4
0
 /// <summary>
 /// Initialize the DI container. This should be called on the outer-most "main" thread, during app initialization
 /// </summary>
 /// <param name="self"></param>
 public static void InitializeDI(this object self)
 {
     MapScope.Initialize();
 }