WebGate.Azure.CloudTablesUtils provides extensions to CloudTable, which allows direct access in the form of CRUD operation to the entities. Complex entities, arrays and IEnumerable are also supported.
using WebGate.Azure.CloudTableUtils.CloudTableExtension
This Extension enables you to do CRUD Operations with your Poco direct to the CloudTable. The Poco do not have to extend TableEntity. The Object De/Serialisation is done inside of the functions and DynamicTableEntity are used to store and retrieve data.
The following operations are provided:
List<MyPoco> pocos = await cloudTable.GetAllAsync<MyPoco>();
Gets all data from a table and convert them into the specified Object. No partition key is applied.
List<MyPoco> pocos = await cloudTable.GetAllAsync<MyPoco>('mypoco');
Gets all data from a table and convert them into the specified Object. A partitionkey is applied. The current example applies 'mypoco' as partitionkey.
MyPoco poco = await.GetByIdAsync<MyPoco>('1018301');
Gets as specific entity from the table and convert it to the specified object. The name of the type is used as partitionkey. In the current example 'MyPoco'. If the id+partitionkey combination finds now object null is returned (using default(T))
MyPoco poco = await.GetByIdAsync<MyPoco>('9201u819','mypoco');
Gets as specific enitity form the table and convert it to the specified object. The partionkey is the 2nd argument. If the id+partitionkey combination finds now object null is returned (using default(T))
TableQuery<DynamicTableEntity> query = new TableQuery<DynamicTableEntity>();
List<MyPoco> pocos = await cloudTable.GetAllByQueryAsync<MyPoco>(query);
Gets alls entites that matches the query.
MyPoco poco = new MyPoco();
// Do magicStuff with poco
TableResult result = await cloudTable.InsertOrMergeAsync("001", "SimplePoco", poco);
Creates or merges a specific object into the cloud table. The selection is done by id and partitionkey.
MyPoco poco = new MyPoco();
// Do magicStuff with poco
TableResult result = await cloudTable.InsertOrReplaceAsync("001", "SimplePoco", poco);
Creates or replace a specific object into the cloud table. The selection is done by id and partitionkey.
TableResult result = await cloudTable.DeleteAsync("001", "SimplePoco");
Deletes a specific object in the cloud table. The selection is done by id and partitionkey.
Apache V 2.0
2021, WebGate Consulting AG