1
votes

I have an Azure Table called "Motion". The table has the following fields:

  • PartitionKey
  • RowKey
  • spaceid
  • readingtime

The casing is the one which shows up in Cloud Explorer in Visual Studio. I query this table using a class "MotionModel"

public class MotionData : TableEntity
    {
        public MotionData() { }

        public string spaceid {get; set;}

        public DateTime readingtime { get; set; }
    }

I get the values correctly. However, if I change this to

public class MotionData : TableEntity
        {
            public MotionData() { }

            public string SpaceId {get; set;}

            public DateTime ReadingTime { get; set; }
        }

I get values in ReadingTime but the SpaceId is null. Is there a guideline around naming the properties for the TableEntity class?

2
Is there any updates about this thread?Tom Sun - MSFT

2 Answers

2
votes

What you are seeing is expected behavior. Azure Table Entity attributes are case-sensitive. From this link:

Property names are case-sensitive strings up to 255 characters in size. Property names should follow naming rules for C# identifiers.

It is perfectly valid to have three attributes in your table named SpaceId, spaceid and SPACEID.

As far as guidelines for naming entity attributes are concerned, AFAIK there's none. It all depends on how you want to create the model. You could design the model and name the properties as you see fit and the storage client library will name the attributes accordingly.

0
votes

As Gaurav mentioned, it is the expected behavior.

I get values in ReadingTime but the SpaceId is null

The ReadingTime value could be “1/1/0001 12:00:00 AM”, It is the MinValue of DateTime displaying for Null DateTime. It may be not the value that you set. Since Spaceid is string type, so it has no null value displaying.