Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Table Storage Doesn't Save Everything in Entity definition

This is the same of the entity that I am planning to save in the Azure Table Storage (ATS):

public class CarEntity : TableEntity
{

    public CarEntity(string objPartitionKey, string objRowKey)
    {
        this.PartitionKey = objPartitionKey;
        this.RowKey = objRowKey;
    }

    public string TableName
    {
        get { return "EntityTableName"; }
    }

    public string Property1 { get; set; }
    // and this goes on
    public string Property60 { get; set; }
}

Not all properties are required. Population of records depend on the selections that the user would be saving (e.g this is a CarEntity - if the user ordered wheels, properties WheelSize and WheelQuantity would be populated, if the user asks for repainting, RepaintingColor would be populated and so, on).

Assuming that there are 60 properties in this entity, not all properties gets saved in ATS. Despite a property being defined and no error being returned, that data doesn't get saved in the table. I know that there's a limit of 1MB per entity but considering the computations that we have done, it is kinda far from the 1MB limit.

Any help why columns don't appear even if the properties are saved accordingly? My save function is defined as follows:

    public static CarEntity CarInsertOrReplace(CarEntity entity)        
    {
        if (entity == null)
        {
            throw new ArgumentNullException("entity");
        }

        var table = SetupTable(entity.TableName);
        table.CreateIfNotExists();

        TableOperation insertOrMergeOperation = TableOperation.InsertOrReplace(entity);

        TableResult result = table.Execute(insertOrMergeOperation);
        CarEntity objEntity = result.Result as CarEntity;
        return objEntity;
    }
like image 832
Patrick Avatar asked Dec 12 '25 22:12

Patrick


1 Answers

Sounds like the properties for your Entity vary based on the usage. What's probably happening is that Azure Table Storage is only creating columns for properties that are not null (have a value set). So you are will only see columns created for properties that have been set.

like image 52
Paul Fryer Avatar answered Dec 15 '25 10:12

Paul Fryer