public void Init() { TransformerCatalog transformerCatalog = TransformerCatalog.TryLoad(); foreach (TransformerConfig transformerConfig in transformerCatalog.Transformers) { Type transformerType = Type.GetType(transformerConfig.TypeName); if (transformerType == null) { throw new Exception($"The type '{transformerConfig.TypeName}' was not found."); } if (!typeof(IContentTransformer).IsAssignableFrom(transformerType)) { throw new Exception($"The type '{transformerType.FullName}' is not assignable to type '{typeof(IContentTransformer).FullName}'."); } IContentTransformer transformer = (IContentTransformer)_container.Resolve(transformerType); if (transformerConfig.ContentSource == null || string.IsNullOrEmpty(transformerConfig.ContentSource.Name)) { throw new Exception($"The transformer '{transformerType.Name}' does not have any content source."); } IContentSource source = _contentSourceService.Build(transformerConfig.ContentSource.Name); source.Init(transformerConfig.ContentSource.Config); ITransformerStoreModel transformerStoreModel = _contentTransformerStorage.AddOrGetTransformer(transformer, source); _transformerProcessors.Add(transformerStoreModel.Id, new TransformerProcessor(_contentTransformerStorage, transformer, source)); } }