Skip to content

Instantly share code, notes, and snippets.

@ChrisTowles
Created March 7, 2016 14:58
Show Gist options
  • Save ChrisTowles/e10c843706e5a3f6f778 to your computer and use it in GitHub Desktop.
Save ChrisTowles/e10c843706e5a3f6f778 to your computer and use it in GitHub Desktop.
Azure Mobile SDK Base Model for Sync Entity
using Microsoft.Azure.Mobile.Server.Tables;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;
namespace Ecrumbs.Service.Data
{
public class AzureServerSyncModelBase : ITableData
{
public DateTimeOffset DeviceCreatedAt { get; set; }
#region Azure Sync Properties
[Key]
[TableColumn(TableColumnType.Id)]
[MaxLength(36)]
public string Id { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
[TableColumn(TableColumnType.CreatedAt)]
public DateTimeOffset? CreatedAt { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
[TableColumn(TableColumnType.UpdatedAt)]
public DateTimeOffset? UpdatedAt { get; set; }
[TableColumn(TableColumnType.Version)]
[Timestamp]
public byte[] Version { get; set; }
[TableColumn(TableColumnType.Deleted)]
public bool Deleted { get; set; }
#endregion
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment