コード例 #1
0
        public async Task GetMissingRecord()
        {
            string storageCon = GetAzureContainerConnectionString();


            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(storageCon);

            // Create the table client.
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            // Create the CloudTable object that represents the "people" table.
            CloudTable table = tableClient.GetTableReference("devsession");

            string appId = "amzn1.ask.skill.63830cb1-27a5-406c-8bf0-03b58ecab7e0";

            string userId = "amzn1.ask.account.AF4KN2MQATPLWG642W6JZ2O552ID3DV7TMWCLKUESJXNS5SYMF4UURDASAHPYLLMPYH3Q6UJLPKGMYTGBNBXH4AMMGCLIV4V26P67UAYUAU5QSERVCPNPBJF7B7RKFO72D756I74XWHY6JV3CPTURZ53OUAFRV7RISJHJQIIZXEZOZ2EC2PBKFBJBBEYKBGLFUZBKYB4SIPAS4Q";

            string userIdHash = GetStringSha256Hash(userId);

            TableOperation retrieveOperation = TableOperation.Retrieve <SessionStorageEntity>(appId, userIdHash);


            TableResult tabResult = await table.ExecuteAsync(retrieveOperation);

            SessionStorageEntity storageEntity = (SessionStorageEntity)tabResult.Result;
        }
コード例 #2
0
        public async Task SetSessionStorage()
        {
            string storageCon = GetAzureContainerConnectionString();


            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(storageCon);

            // Create the table client.
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            // Create the CloudTable object that represents the "people" table.
            CloudTable table = tableClient.GetTableReference("devsession");

            string appId = "someappid";

            string userId = "someuserid";

            // Create a new customer entity.
            SessionStorageEntity sessionEntity = new SessionStorageEntity(appId, userId);

            sessionEntity.CurrentNodeName = "CurNode";
            sessionEntity.LastAccessTime  = DateTime.UtcNow;

            // Create the TableOperation object that inserts the customer entity.
            TableOperation insertOperation = TableOperation.InsertOrReplace(sessionEntity);

            await table.ExecuteAsync(insertOperation);



            TableOperation retrieveOperation = TableOperation.Retrieve <SessionStorageEntity>(appId, userId);


            TableResult tabResult = await table.ExecuteAsync(retrieveOperation);

            SessionStorageEntity storageEntity = (SessionStorageEntity)tabResult.Result;
        }