InsertAsync Xamarin Invalid data type provided

Viewed 61

I have a problem with the InsertAsync function. I hope I'm not disturbing. The object I'm trying to insert is called User, it has 3 properties Id, username & password. When I call the InsertAsync() method (without giving any id and having the ID autoincrement on and IDENTITY_INSERT OFF) it throws an invalid data type provided error. If I delete the identity on id and I set an id value from the code it works. But I want it to work with the autoincrement method. Thank you! photo with the error

    using Microsoft.WindowsAzure.MobileServices;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
//using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;
using System.Text;

namespace MapProject.DataModels
{
    public class Users
    {
        [JsonProperty("id")]
        public string Id { get; set; }
        [JsonProperty("user")]
        public string User { get; set; }
        [JsonProperty("password")]
        public string Password { get; set; }
        [JsonProperty("Email")]
        public string Email { get; set; }
        [JsonProperty("Height")]
        public double Height { get; set; }
        [JsonProperty("Weight")]
        public double Weight { get; set; }
        [JsonProperty("RiskLevel")]
        public int RiskLevel { get; set; }
  /*
         [Version]
        [JsonProperty(PropertyName = "version")]
        public byte[] Version { get; set; }

        [JsonProperty(PropertyName = "createdAt")]
        public DateTime? CreatedAt { get; set; }

        [JsonProperty(PropertyName = "updatedAt")]
        public DateTime? UpdatedAt { get; set; }

  */  
        public bool IsPassword(string password)
        {
            return Password == password;
        }
    }
}
0 Answers
Related