how to join will null?
I have this logic:
but I don't need it. If something bad with channelSettingsResponse, I'd like to return
private async Task OnChannelsGet(
IDeliveryHandlerContext context,
MessagingSubjectsChannelsGetArguments arguments)
{
var channelsGetResponse = await _messagingChannelsClient
.ChannelsGet(new(arguments.Names))
.Unwrap();
var channelSettingsResponse = await _systemServiceClient
.DataGet(new(arguments.Names))
.Unwrap();
var channelSettingsSchema = await ChannelSettingsSchemaCreate();
var result = channelsGetResponse.Items
.Join( channelSettingsResponse.Items,
mutationDto => mutationDto.Name,
channelSettingsDto => channelSettingsDto.Key,
(channelDto, channelSettingsDto) =>
new MessagingSubjectsChannelGetDto
{
Name = channelDto.Name,
Title = channelDto.Title.GetValue(context.Culture),
Description = channelDto.Description.GetValue(context.Culture),
Configuration = channelDto.Configuration,
Settings = channelSettingsDto.Data.FromJson<ChannelSettingsDto>(),
SettingsSchema = channelSettingsSchema
} )
.ToList();
await context.TryRespondOk(new MessagingSubjectsChannelsGetResponse(result));
}private async Task OnChannelsGet(
IDeliveryHandlerContext context,
MessagingSubjectsChannelsGetArguments arguments)
{
var channelsGetResponse = await _messagingChannelsClient
.ChannelsGet(new(arguments.Names))
.Unwrap();
var channelSettingsResponse = await _systemServiceClient
.DataGet(new(arguments.Names))
.Unwrap();
var channelSettingsSchema = await ChannelSettingsSchemaCreate();
var result = channelsGetResponse.Items
.Join( channelSettingsResponse.Items,
mutationDto => mutationDto.Name,
channelSettingsDto => channelSettingsDto.Key,
(channelDto, channelSettingsDto) =>
new MessagingSubjectsChannelGetDto
{
Name = channelDto.Name,
Title = channelDto.Title.GetValue(context.Culture),
Description = channelDto.Description.GetValue(context.Culture),
Configuration = channelDto.Configuration,
Settings = channelSettingsDto.Data.FromJson<ChannelSettingsDto>(),
SettingsSchema = channelSettingsSchema
} )
.ToList();
await context.TryRespondOk(new MessagingSubjectsChannelsGetResponse(result));
}channelSettingsResponsechannelSettingsResponse can be null or we couldn't join by keys and now result will be nullbut I don't need it. If something bad with channelSettingsResponse, I'd like to return
new MessagingSubjectsChannelGetDto
{
Name = channelDto.Name,
Title = channelDto.Title.GetValue(context.Culture),
Description = channelDto.Description.GetValue(context.Culture),
Configuration = channelDto.Configuration,
Settings = null,
SettingsSchema = channelSettingsSchema
} )new MessagingSubjectsChannelGetDto
{
Name = channelDto.Name,
Title = channelDto.Title.GetValue(context.Culture),
Description = channelDto.Description.GetValue(context.Culture),
Configuration = channelDto.Configuration,
Settings = null,
SettingsSchema = channelSettingsSchema
} )