All the sample applications and code that I have come across for consuming Azure mobile services don't follow MVVM pattern for simplicity.
How would one write an MVVM application that uses Azure mobile services for accessing data in cloud and then cache the data in Windows phone Local Database (model). My existing Model classes were like this -
[Table]
public class ToDoItem
{
[Column(IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false, AutoSync = AutoSync.OnInsert)]
public int ToDoItemId
{
...
}
[Column]
public string ItemName
{
...
}
[Column]
public bool IsComplete
{
...
}
}
And now that I want to work with this data in cloud, the samples tell me that I need to structure my classes like this -
public class TodoItem
{
public string Id { get; set; }
[JsonProperty(PropertyName = "text")]
public string Text { get; set; }
[JsonProperty(PropertyName = "complete")]
public bool Complete { get; set; }
}
How does this fit in the MVVM pattern? What do my model classes need to look like. Do I use both versions of ToDoItem classes one for setting/getting data from local database and the other for setting/getting data from the cloud and something to convert one to the other? Is there a sample someone can point me to?