Skip to content

Ignore attribute not working #390

@Stuart88

Description

@Stuart88

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);
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions