Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        internal virtual AzureUser SetEntityKeys()
        {
            var key = AzureUserKey.ForUserId(this.Id);

            this.PartitionKey = key.Partition;
            this.RowKey       = key.Row;

            return(this);
        }
Ejemplo n.º 3
0
        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);
        }