Пример #1
0
        /// <summary>
        /// Asynchronously retrieves all domain entities within a given Index.
        /// </summary>
        /// <param name="indexKey">Key to be used as the index. If it's not a string it will be serialized to JSON first and then used as the index name key (a.k.a. Partition Key)</param>
        /// <returns></returns>
        public IEnumerable <TDomainEntity> GetAllItemsFromIndex(object indexKey)
        {
            if (indexKey is string key)
            {
                return(TableOperationsService.GetByPartitionKey(key).Select(tableEntity => tableEntity.DomainObjectInstance));
            }
            var serializedPartitionKey = JsonConvert.SerializeObject(indexKey);

            return(TableOperationsService.GetByPartitionKey(serializedPartitionKey).Select(azureTableEntity => azureTableEntity.DomainObjectInstance));
        }
Пример #2
0
 /// <summary>
 /// Gets all the entities via the <see cref="DefaultIndex"/> asynchronously. This is usually the index that retrieves items by ID so all
 /// entities should be unique by default
 /// </summary>
 /// <returns></returns>
 public IEnumerable <TDomainEntity> GetAll()
 {
     return(TableOperationsService.GetByPartitionKey(_defaultIndexDefinitionName).Select(cloudTableEntity => cloudTableEntity.DomainObjectInstance));
 }