/// <summary> /// Instantiates a new instance of <see cref="EntityTableEntity{TEntity}"/> specificly setting <see cref="Microsoft.WindowsAzure.Storage.Table.TableEntity.PartitionKey"/> and <see cref="Microsoft.WindowsAzure.Storage.Table.TableEntity.RowKey"/>. /// </summary> public EntityTableEntity(TEntity entity) { PartitionKey = StorageStore <object, object> .GetSafeStorageKey(entity.GetType().FullName); RowKey = StorageStore <object, object> .GetSafeStorageKey(entity.Rsn.ToString("N")); _entity = entity; _entityContent = Serialise(Entity); }
/// <summary> /// Instantiates a new instance of <see cref="EventDataTableEntity{TEntity}"/> specificly setting <see cref="Microsoft.WindowsAzure.Storage.Table.TableEntity.PartitionKey"/> and <see cref="Microsoft.WindowsAzure.Storage.Table.TableEntity.RowKey"/>. /// </summary> public EventDataTableEntity(TEventData eventData, bool isCorrelationIdTableStorageStore = false) { PartitionKey = StorageStore <object, object> .GetSafeStorageKey(isCorrelationIdTableStorageStore?eventData.CorrelationId.ToString("N") : eventData.AggregateId); RowKey = StorageStore <object, object> .GetSafeStorageKey(eventData.EventId.ToString("N")); _eventData = eventData; _eventDataContent = Serialise(EventData); }
/// <summary> /// Retrieves the data from Azure Storage using <see cref="Collection"/>. /// </summary> public virtual IEnumerable <TData> GetByKey() { // Create the table query. var rangeQuery = Collection.Where ( TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, StorageStore <object, object> .GetSafeStorageKey(typeof(TCollectionItemData).FullName)) ); return(ReadableSource.ExecuteQuery(rangeQuery)); }
/// <summary> /// Retrieves the data from Azure Storage using <see cref="Collection"/>. /// </summary> public virtual TData GetByKeyAndRow(Guid rsn) { // Create the table query. var rangeQuery = Collection.Where ( TableQuery.CombineFilters ( TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, StorageStore <object, object> .GetSafeStorageKey(typeof(TCollectionItemData).FullName)), TableOperators.And, TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.Equal, StorageStore <object, object> .GetSafeStorageKey(rsn.ToString("N"))) ) ); return(ReadableSource.ExecuteQuery(rangeQuery).Single()); }