private async Task <TUser> GetUserByReference(AzureUserReferenceKey referenceKey) { this.ThrowIfDisposed(); var op = TableOperation.Retrieve <AzureUserReference>(referenceKey.Partition, referenceKey.Row); var result = await this.ExecuteAsync(op); if (result.HttpStatusCode != 200) { return(null); } var reference = (AzureUserReference)result.Result; if (reference.UserId == null) { // TODO: log error because this should never happen. reference.UserId = String.Empty; } var userKey = AzureUserKey.ForUserId(reference.UserId); op = TableOperation.Retrieve <TUser>(userKey.Partition, userKey.Row); result = await this.ExecuteAsync(op); return((TUser)result.Result); }
internal virtual AzureUser SetEntityKeys() { var key = AzureUserKey.ForUserId(this.Id); this.PartitionKey = key.Partition; this.RowKey = key.Row; return(this); }
public async Task <TUser> FindByIdAsync(string userId, CancellationToken cancellationToken) { var key = AzureUserKey.ForUserId(userId); var op = TableOperation.Retrieve <TUser>(key.Partition, key.Row); var result = await this.ExecuteAsync(op); return((TUser)result.Result); }