Book Image

Microsoft Azure Storage Essentials

By : Chukri A Soueidi
Book Image

Microsoft Azure Storage Essentials

By: Chukri A Soueidi

Overview of this book

Table of Contents (16 chapters)
Microsoft Azure Storage Essentials
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Adding entities to a table


After creating the table, Weather, we need to populate it with entities. In the .NET library, entities are mapped to C# objects. The library defines the ITableEntity interface which should be implemented by all classes representing entities.

The ITableEntity interface defines the following properties:

  • PartitionKey: It is a string for the partition key of the an entity

  • RowKey: It is a string for the row key

  • Timestamp: It is a DateTime offset for the last update on the entity

  • ETag: It is an entity tag for managing concurrency

The library also contains two classes that implement ITableEntity.

The TableEntity is a base class that can be inherited by custom classes. The DynamicTableEntity is a class that holds an IDictionary<String,EntityProperty> property named Properties that is used to store properties inside it.

Now, let's define our custom entity by inheriting from the TableEntity base class:

  public class WeatherEntity : TableEntity
  {
    public WeatherEntity...