Why is there a string ID in the data model of Azure Mobile Apps?

后端 未结 1 2068
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-20 14:44

I\'m working the C# in Azure Mobile Apps trying to learn them. I created the Model to link to my Azure SQL DB, created a DataObject like this:

public class Acco         


        
1条回答
  •  醉梦人生
    2021-02-20 15:24

    The EntityData abstract class contains the additional fields - there are five fields for Mobile offline sync

    • Id (a string - normally a GUID - must be globally unique)
    • UpdatedAt (DateTimeOffset - maintained automatically via a database trigger - used for incremental sync)
    • CreateAt (DateTimeOffset - used as the key into the database partition to optimize reading, but unused otherwise)
    • Version (a byte[] - timestamp - used for optimistic concurrency / conflict resolution)
    • Deleted (a Boolean - used to update other clients when a record is deleted - known as soft delete).

    Your client needs all these fields in its client model except for Deleted (which isn't transferred unless requested and is dealt with automatically via the Mobile Apps SDK for clearing the offline sync of deleted records).

    You haven't said what languages are in use on backend or frontend. However, logging is available in both cases - you just have to turn it on, capture the exceptions, etc. Some references for you:

    • Node (backend): https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-node-backend-how-to-use-server-sdk/
    • .NET (backend): https://shellmonger.com/2016/05/11/30-days-of-zumo-v2-azure-mobile-apps-day-19-asp-net-table-controllers/

    0 讨论(0)
提交回复
热议问题