/// <summary> /// Asynchronously builds a name of the associated instance /// </summary> /// <param name="culture">A <see cref="CultureInfo" /> specifying the language of the constructed name</param> /// <returns>A <see cref="Task{String}" /> representing the asynchronous operation</returns> /// <exception cref="NameExpressionException">Error occurred while evaluating name expression</exception> public async Task <string> BuildNameAsync(CultureInfo culture) { var urnString = await _operand.GetStringValue().ConfigureAwait(false); var urn = URN.Parse(urnString); string name = null; if (urn.Type == "player") { var profile = await _profileCache.GetPlayerProfileAsync(urn, new[] { culture }).ConfigureAwait(false); name = profile?.GetName(culture); } else if (urn.Type == "competitor") { var profile = await _profileCache.GetCompetitorProfileAsync(urn, new[] { culture }).ConfigureAwait(false); name = profile?.GetName(culture); } return(name); }
/// <summary> /// Asynchronously builds a name of the associated instance /// </summary> /// <param name="culture">A <see cref="CultureInfo" /> specifying the language of the constructed name</param> /// <returns>A <see cref="Task{String}" /> representing the asynchronous operation</returns> /// <exception cref="NameExpressionException">Market specifiers do not contain required specifier</exception> public Task <string> BuildNameAsync(CultureInfo culture) { return(_operand.GetStringValue()); }