Exemplo n.º 1
0
        /// <summary>
        /// Query topic name
        /// </summary>
        /// <param name="appHandle">App handle</param>
        /// <param name="topicName">Topic name</param>
        /// <returns>Query topic name task</returns>
        public async Task <ITopicNameEntity> QueryTopicName(string appHandle, string topicName)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.TopicNames);

            ObjectTable     table           = this.tableStoreManager.GetTable(ContainerIdentifier.TopicNames, TableIdentifier.TopicNamesObject) as ObjectTable;
            string          objectKey       = this.GetTopicNameObjectKey(appHandle, topicName);
            TopicNameEntity topicNameEntity = await store.QueryObjectAsync <TopicNameEntity>(table, objectKey, objectKey);

            return(topicNameEntity);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Insert topic name
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="appHandle">App handle</param>
        /// <param name="topicName">Topic name</param>
        /// <param name="topicHandle">Topic handle</param>
        /// <returns>Insert topic name task</returns>
        public async Task InsertTopicName(
            StorageConsistencyMode storageConsistencyMode,
            string appHandle,
            string topicName,
            string topicHandle)
        {
            TopicNameEntity topicNameEntity = new TopicNameEntity()
            {
                PublisherType = PublisherType.App,
                TopicName     = topicName,
                AppHandle     = appHandle,
                TopicHandle   = topicHandle,
            };

            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.TopicNames);

            ObjectTable table     = this.tableStoreManager.GetTable(ContainerIdentifier.TopicNames, TableIdentifier.TopicNamesObject) as ObjectTable;
            string      objectKey = this.GetTopicNameObjectKey(appHandle, topicName);
            Operation   operation = Operation.Insert(table, objectKey, objectKey, topicNameEntity);
            await store.ExecuteOperationAsync(operation, storageConsistencyMode.ToConsistencyMode());
        }