public void Add(ConfiguredObjectFactory objectFactory) { ThrowIfConflictingItemExists( objectFactory, _objectFactories, (of1, of2) => $"An object factory for type {of1.ObjectTypeName} has already been configured"); ObjectFactories.AddOrReplaceThenSort(objectFactory); }
public void Add(ConfiguredObjectFactory objectFactory) { ThrowIfConflictingItemExists( objectFactory, _objectFactories, (factory, conflictingFactory) => string.Format( CultureInfo.InvariantCulture, "{0} factory for type {1} has already been configured", conflictingFactory.IsMappingFactory() ? "A mapping" : "An object", factory.ObjectType.GetFriendlyName())); if (objectFactory.ObjectType.IsSimple()) { HasSimpleTypeValueFactories = true; } if (objectFactory.IsMappingFactory()) { HasMappingFactories = true; } ObjectFactories.AddOrReplaceThenSort(objectFactory); }
public void Add(ConfiguredObjectFactory objectFactory) => _objectFactories.Add(objectFactory);