public IEnumerable <FileTemplate> Write(JsonWriteConfiguration configuration, List <ITransferObject> transferObjects) { ModelTransferObject model = transferObjects.OfType <ModelTransferObject>().FirstOrDefault(); if (model == null) { throw new InvalidOperationException("Can not create JsonObjectReader without object. Add in settings a read configuration"); } if (!configuration.Language.IsCsharp()) { throw new InvalidOperationException($"Can not generate JsonReader ({configuration.Reader.Name}) for language {configuration.Language}"); } Logger.Trace("Write JsonReader..."); string className = configuration.Reader.Name ?? model.Name + "Reader"; FileTemplate fileTemplate = new FileTemplate(configuration.Reader.RelativePath, configuration.AddHeader); ClassTemplate classTemplate = fileTemplate.AddNamespace(configuration.Reader.Namespace ?? model.Namespace ?? configuration.Object.Namespace) .AddClass(className) .FormatName(configuration); WriteReader(classTemplate, model, configuration.FormatNames); yield return(fileTemplate); }