public static InstanceUnmarshaller GetInstance() { if (instance == null) { instance = new InstanceUnmarshaller(); } return(instance); }
public Reservation Unmarshall(XmlUnmarshallerContext context) { Reservation reservation = new Reservation(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 1; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("reservationId", targetDepth)) { reservation.ReservationId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ownerId", targetDepth)) { reservation.OwnerId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("requesterId", targetDepth)) { reservation.RequesterId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("groupSet/item", targetDepth)) { reservation.Groups.Add(GroupIdentifierUnmarshaller.GetInstance().Unmarshall(context)); continue; } if (context.TestExpression("groupSet/item/groupName", targetDepth)) { reservation.GroupNames.Add(StringUnmarshaller.GetInstance().Unmarshall(context)); continue; } if (context.TestExpression("instancesSet/item", targetDepth)) { reservation.Instances.Add(InstanceUnmarshaller.GetInstance().Unmarshall(context)); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return(reservation); } } return(reservation); }