Ejemplo n.º 1
0
        /// <summary>
        /// get signature from azure mobile apps(custom function)
        /// </summary>
        /// <param name="containerName"></param>
        /// <returns></returns>
        private static async Task <string> getSignature(string containerName)
        {
            // Get from session
            var session = App.SessionRepository.GetValue <BlobSignature>($"BlobSignature{containerName}");

            if (session != null && session.Expire.AddMinutes(-5) > DateTimeOffset.UtcNow)
            {
                return(session.Signature);
            }
            // get Signature from Azure mobile apps.
            var signature = await CustomFunction.Get <BlobSignature>($"api/values/blobsignature/{containerName}");

            App.SessionRepository.SetValue($"BlobSignature{containerName}", signature);
            return(signature?.Signature);
        }