SQLite.Net-PCL
SQLite.Net-PCL copied to clipboard
Ignore attribute not working
This is on the latest stable version of the library (1.8.116)
I'm not sure if this is a bug or by design.
The ignored 'Number' column in the below class is being added to the table upon creation of the database.
[Table("Questions")]
public class Question
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
[Unique, NotNull]
public string UrlCode { get; set; }
[NotNull]
public string QuestionText { get; set; }
[NotNull]
public string QuestionAnswer { get; set; }
[Ignore]
public int Number { get; set; } = 1;
}
Current workaround is to ignore the column in OnModelCreating instead:
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Question>().Ignore(q => q.Number);
}