Skip to content

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.

License

Notifications You must be signed in to change notification settings

WebGateConsultingAG/AzureCloudTableUtils

Repository files navigation

WebGate.Azure.CloudTableUtils

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.


Extensions for CloudTable

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:

GetAllAsync()

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.

GetAllAsync(string partition)

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.

GetByIdAsync(string id)

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))

GetByIdAsync(string id, string partition)

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))

GetAllByQueryAsync(TableQuery query)

TableQuery<DynamicTableEntity> query = new TableQuery<DynamicTableEntity>();
List<MyPoco> pocos = await cloudTable.GetAllByQueryAsync<MyPoco>(query);

Gets alls entites that matches the query.

InsertOrMergeAsync(string id, string partition, object obj)

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.

InsertOrReplaceAsync(string id, string partition, object obj)

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.

DeleteEntryAsync(string id, string partition)

TableResult result = await cloudTable.DeleteAsync("001", "SimplePoco");

Deletes a specific object in the cloud table. The selection is done by id and partitionkey.


Code Quality Check SonarCloud.io

Quality gate


Licence

Apache V 2.0


Copyright

2021, WebGate Consulting AG

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Languages