public void FactoryExists(IRDomFactory factory, Type type, IDom item) { if (factory == null) { throw new InvalidOperationException(); } }
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); }
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 })); } }