/// <inheritdoc /> public MapBonus Convert(MapBonusDTO value, object state) { var entity = new UnknownMapBonus(); this.Merge(entity, value, state); return(entity); }
/// <summary>Converts the given object of type <see cref="MapBonusDataContract"/> to an object of type <see cref="MapBonus"/>.</summary> /// <param name="value">The value to convert.</param> /// <param name="state"></param> /// <returns>The converted value.</returns> public MapBonus Convert(MapBonusDataContract value, object state) { if (value == null) { throw new ArgumentNullException("value", "Precondition: value != null"); } MapBonus mapBonus; if (string.Equals(value.Type, "bloodlust", StringComparison.OrdinalIgnoreCase)) { mapBonus = new Bloodlust(); } else { mapBonus = new UnknownMapBonus(); } var owner = value.Owner; if (owner != null) { mapBonus.Owner = this.converterForTeamColor.Convert(owner, state); } return(mapBonus); }
// Implement this method in a buddy class to set properties that are specific to 'UnknownMapBonus' (if any) partial void Merge(UnknownMapBonus entity, MapBonusDTO dto, object state);