dtretyakov/WindowsAzure

Getting a record

Closed this issue · 1 comments

What is the best way to get a message based on the PartitionKey and the RowKey? If I use the attributes on my poco to show which property is the PartitionKey and which is the RowKey, those properties get stored in the PartitionKey and the RowKey columns in the table and there are no table columns with the original property name. So then if I go to use LINQ to query a record I can't access the POCO.OriginalPropertyName because there is no OriginalPropertyName in the table, and I can't do POCO.PartitionKey because that doesn't exist on the POCO itself.

The only thing I can think of is having a built-in method for Get that accepts a PartitionKey and a RowKey where it can then translate that into the appropriate query against those columns and populate the POCO properties accordingly.

Or am I missing something that is already there?

WASE hides properties mapping from library's consumer. So when you mark POCO properties by PK or RK attributes library transparently uses those properties to get / set / query values of PK and RK in the Table Entity, for instance:

POCO Table Entity
[PK] Continent PartitionKey
[RK] Region RowKey
[Property("AR")] Area AR
... ...
Country Country

Thus you could not find Continent, Region and Area in table columns.

Note: if you want to use not meaningful name-aliases like PartitionKey and RowKey you can do that, but don't forget to mark it by PK and RK attributes.