devlooped / TableStorage

Repository pattern with POCO object support for storing to Azure / Cosmos DB Table Storage

Home Page:https://clarius.org/TableStorage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KeyProperties are not being persisted properly

pgaliano opened this issue · comments

Given the following repos:

repository1 = TableRepository.Create(
storageAccount,
tableName: "Dependency",
partitionKey: d => d.Repository,
rowKey: d => $"{d.Name}-{d.Version}");

repository2 = TableRepository.Create(
storageAccount,
tableName: "Dependency",
partitionKey: d => d.Name,
rowKey: d => $"{d.Version}-{d.Repository}")

After doing:

var dependency = new Dependency(){Name="foo", Repository="bar", Version="1.0"};
await repository1.PutAsync(dependency);
await repository2.PutAsync(dependency);

The created items in the table are as follows:

PartitionKey|RowKey|Name|Version
bar|foo-1.0|foo|null|1.0
foo|1.0-bar|foo|null|1.0

Expected:
PartitionKey|RowKey|Name|Repository|Version
bar|foo-1.0|foo|null|1.0
foo|1.0-bar|null|bar|1.0