/// <summary>
/// Generates the response unmarshaller along with any dependent structure unmarshallers that are called by this response unmarshaller.
/// </summary>
/// <param name="operation">The operation to generate the unmarshaller for</param>
void GenerateResponseUnmarshaller(Operation operation)
{
{
var generator = GetResponseUnmarshaller();
generator.Operation = operation;
generator.IsWrapped = operation.IsResponseWrapped;
generator.HasSuppressedResult = this.config.ServiceModel.Customizations.ResultGenerationSuppressions.Contains(operation.Name);
var modifier = operation.model.Customizations.GetOperationModifiers(operation.Name);
if (modifier != null)
{
// can use wrapped member to effect a rename, even though we don't push response
// members down into a wrapped class
generator.WrappedResultMember = modifier.WrappedResultMember;
generator.IsWrapped = modifier.UseWrappingResult;
}
this.ExecuteGenerator(generator, operation.Name + "ResponseUnmarshaller.cs", "Model.Internal.MarshallTransformations");
// Add to the list of processed unmarshallers so we don't attempt to generate a generic structure unmarshaller.
if (operation.ResponseStructure != null)
{
// Mark the shape as processed if it's being referred only as operation's
// output shape and not being referred directly by any other shape or via an
// operation modifier generating an artifical structure not in the service model.
if (!IsShapeReferred(operation.ResponseStructure.Name, this.config.ServiceModel) &&
!operation.WrapsResultShape(operation.ResponseStructure.Name))
{
this.processedUnmarshallers.Add(operation.ResponseStructure.Name);
}
}
}
if (operation.ResponseStructure != null)
{
var lookup = new NestedStructureLookup();
lookup.SearchForNestedStructures(operation.ResponseStructure);
foreach (var nestedStructure in lookup.NestedStructures)
{
if (this.config.ServiceModel.Customizations.IsSubstitutedShape(nestedStructure.Name))
{
continue;
}
// Skip already processed unmarshallers. This handles the case of structures being returned in mulitiple requests.
if (!this.processedUnmarshallers.Contains(nestedStructure.Name))
{
var generator = GetStructureUnmarshaller();
generator.Structure = nestedStructure;
this.ExecuteGenerator(generator, nestedStructure.Name + "Unmarshaller.cs", "Model.Internal.MarshallTransformations");
this.processedUnmarshallers.Add(nestedStructure.Name);
}
else
{
//throw new Exception();
}
}
}
}