Azure C# - Update a particular entry in a row

i have a table on azure and i wish to update a particular entry in the table. when I try to update the table with the .UpdateAsync(object); method, the whole row is replaced with null values and the parameters specified only gets updated

UPDATE CODE

 ipray_users data = new ipray_users {id= settings["userid"].ToString(), favorite = String.Format(globals.id + "#") };
 await App.MobileService.GetTable<ipray_users>().UpdateAsync(data);

ipray_users class

class ipray_users
{
    public string id { get; set; }
    public int age { get; set; }
    public string email { get; set; }
    public string gender { get; set; }       
    public string country { get; set; }
    public string name { get; set; }
    public string favorite { get; set; }

}

Answers


If you want to update only a certain subset of properties of your object, you can use the "untyped" (JSON) overload of the UpdateAsync call, which lets you pass a JSON object with only the properties that you want updated. In your example, it would look something like the code below:

JObject data = new JObject {
    { "id", settings["userid"].ToString() },
    { "favorite", String.Format(globals.id + "#") }
}
await App.MobileService.GetTable<ipray_users>().UpdateAsync(data);

Need Your Help

Remove duplicates of wp_user foreach with array_unique - rendering error?

php wordpress foreach taxonomy array-unique

Combining taxonomies and user roles, I am listing all terms of tax "dog", and for each term "dog", a list of all "colors" that are linked to a user profile. EXAMPLE:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.