public bool TryExecute(IGenerator generator) { IGeneratorExecutor generatorExecutor = _featureParts.GetFeatureParts <IGeneratorExecutor>(x => x.IsApplicable(generator)).FirstOrDefault(); if (generatorExecutor != null) { return(generatorExecutor.TryExecute(generator, this)); } throw new InvalidOperationException($"There is no T4 generator executor for type '{generator.GetType()}'."); }