Beispiel #1
0
        public static StreamsIdEntity Create(IStreamsIdData src)
        {
            var streamsId = Guid.NewGuid().ToString("D");

            var result = new StreamsIdEntity
            {
                PartitionKey = GeneratePartitionKey(),
                RowKey       = GenerateRowKey(src.ClientId),
                ClientId     = src.ClientId,
                StreamsId    = streamsId
            };

            return(result);
        }
Beispiel #2
0
        public async Task <IStreamsIdData> GetOrCreateAsync(string clientId)
        {
            var partitionKey = StreamsIdEntity.GeneratePartitionKey();
            var rowKey       = StreamsIdEntity.GenerateRowKey(clientId);

            var data = await _streamsIdTableStorage.GetDataAsync(partitionKey, rowKey);

            if (data != null)
            {
                return(data);
            }

            var newEntity = StreamsIdEntity.Create(new StreamsIdEntity {
                ClientId = clientId
            });
            await _streamsIdTableStorage.InsertAsync(newEntity);

            return(newEntity);
        }
Beispiel #3
0
        public async Task <IEnumerable <IStreamsIdData> > GetStreamsIdsAsync()
        {
            var partitionKey = StreamsIdEntity.GeneratePartitionKey();

            return(await _streamsIdTableStorage.GetDataAsync(partitionKey));
        }
Beispiel #4
0
 public async Task SaveAsync(IStreamsIdData streamsIdData)
 {
     var newEntity = StreamsIdEntity.Create(streamsIdData);
     await _streamsIdTableStorage.InsertAsync(newEntity);
 }