Exemplo n.º 1
0
 public void FactoryExists(IRDomFactory factory, Type type, IDom item)
 {
     if (factory == null)
     {
         throw new InvalidOperationException();
     }
 }
Exemplo n.º 2
0
 private bool AddFactoriesToLookup(IRDomFactory factory, Type[] types, IDictionary <Type, IRDomFactory> dictionary)
 {
     if (types == null)
     {
         return(false);
     }
     foreach (var type in types)
     {
         if (dictionary.Keys.Contains(type))
         {
             Guardian.Assert.DuplicateFactories(type.Name, factory.GetType().FullName);
         }
         else
         {
             dictionary.Add(type, factory);
         }
     }
     return(true);
 }
Exemplo n.º 3
0
 private void AddFactoryToLookup(IDictionary <Type, IList <IRDomFactory> > dictionary, IRDomFactory factory, Type[] types)
 {
     foreach (var type in types)
     {
         IList <IRDomFactory> list;
         if (dictionary.TryGetValue(type, out list))
         {
             // Insert descending
             var next = list.FirstOrDefault(x => x.Priority < factory.Priority);
             if (next == null)
             {
                 list.Add(factory);
             }
             else
             {
                 list.Insert(list.IndexOf(next), factory);
             }
             return;
         }
         dictionary.Add(type, new List <IRDomFactory>(new[] { factory }));
     }
 }