jeudi 27 août 2015

Error in SQLite in Xamarin when Try to insert obj that has proerty into database [duplicate]

This question already has an answer here:

Now I'm working on andriod project using Xamarin,

the app need database, in my case I have Class called AlarmCheckPoint which has fields and property

when when I try to add it into database app crashed

but If I remove the property It works fine, , what should I do? I really need this property I my business role!!

This is my class

 public class AlarmCheckPoint : Java.Lang.Object
{
    private string _alarmLevel;
    public AlarmCheckPoint()
    {
    }

    [PrimaryKey, AutoIncrement, Column("_id")]
    public int Id { get; set; }

    public string Name { get; set; }

    public string Date { get; set; }

    public string Time { get; set; }

    public string AlarmMessage { get; set; }

    public string AlarmLevel
    {
        get
        {
            switch (AlarmLevel.ToLower())
            {
                case "low":
                    return "Don't Worry, I just need your help";
                case "medium":
                    return "I need your help, Please";
                case "high":
                    return "PLEASE HELP";
                case "severe":
                    return "I am Lost, PLEASE HEP!";
                default:
                    return _alarmLevel;

            }
        }
        set { _alarmLevel = value; }
    } 
    public int ContactId { get; set; }

    public bool ActiveMode { get; set; }
}

Aucun commentaire:

Enregistrer un commentaire