I'm importing an Android code to windows rt and I need the data to be compatible on both apps. When creating my sqlite database I need to set a default value to a column, doing something like
CREATE TABLE [blabla] ( [id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, [bleh] INTEGER NOT NULL DEFAULT -1 )
I wrote my C# code, using SQLite-net this way:
[Table("blabla")]
public class Blabla {
[PrimaryKey, AutoIncrement, NotNull]
public int id { get; set; }
[NotNull]
public int bleh { get; set; }
}
But I can't set the default value to 'bleh'. I need both database to be the same =/ Can anyone help me with this?
Thanks =)
Why don't you use:
private int _bleh = 1;
[NotNull]
public int Bleh
{
get { return _bleh; }
set { _bleh = value; }
}
Then bleh will always have a default of 1 unless changed
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With