public static string CreatePartitionKey(Party party, PartyEntityType partyEntityType) { if (party.ChannelAccount != null) { return($"{party.ChannelAccount.Id}|{partyEntityType.ToString()}"); } return($"{party.ChannelId}|{partyEntityType.ToString()}"); }
/// <summary> /// Resolves the cloud table associated with the given party entity type. /// </summary> /// <param name="partyEntityType">The party entity type.</param> /// <returns>The cloud table associated with the party entity type.</returns> protected virtual CloudTable CloudTableByPartyEntityType(PartyEntityType partyEntityType) { switch (partyEntityType) { case PartyEntityType.Bot: return(_botPartiesTable); case PartyEntityType.User: return(_userPartiesTable); case PartyEntityType.Aggregation: return(_aggregationPartiesTable); case PartyEntityType.PendingRequest: return(_pendingRequestsTable); default: throw new ArgumentException($"No cloud table associated with party entity type {partyEntityType}"); } }
public PartyEntity(Party party, PartyEntityType partyEntityType) { PartitionKey = CreatePartitionKey(party, partyEntityType); RowKey = CreateRowKey(party); ChannelId = party.ChannelId; ServiceUrl = party.ServiceUrl; PartyEntityType = partyEntityType.ToString(); if (party.ChannelAccount != null) { ChannelAccountId = party.ChannelAccount.Id; ChannelAccountName = party.ChannelAccount.Name; } if (party.ConversationAccount != null) { ConversationAccountId = party.ConversationAccount.Id; ConversationAccountName = party.ConversationAccount.Name; } ConnectionRequestTime = DateTimeToString(party.ConnectionRequestTime); ConnectionEstablishedTime = DateTimeToString(party.ConnectionEstablishedTime); }
/// <summary> /// /// </summary> /// <param name="partyEntityType"></param> /// <returns></returns> protected virtual async Task <IEnumerable <PartyEntity> > GetPartyEntitiesAsync(PartyEntityType partyEntityType) { TableQuery <PartyEntity> tableQuery = new TableQuery <PartyEntity>(); return(await GetPartyEntitiesAsync(CloudTableByPartyEntityType(partyEntityType), tableQuery)); }