Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7787131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:33:54+00:00 2026-06-01T20:33:54+00:00

In relation to another SO post I need to update my model so that

  • 0

In relation to another SO post I need to update my model so that the ‘new’ column ActiveBool doesn’t try to get matched against a database table.

The model:

public class StatusList
    {
        [Key]
        public int StatusID { get; set; }

        [Required]        
        public byte Active { get; set; }

       //I want this column to be ignored by Entity Framework
        public bool ActiveBool
        {
            get { return Active > 0; }
            set { Active = value ? Convert.ToByte(1) : Convert.ToByte(0); }

        }
    }

Is there an DataAnnotation that can be used?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:33:56+00:00Added an answer on June 1, 2026 at 8:33 pm

    You need to use the [NotMapped] annotation:

    public class StatusList 
        { 
            [Key] 
            public int StatusID { get; set; } 
    
            [Required]         
            public byte Active { get; set; } 
    
           //I want this column to be ignored by Entity Framework so I add [NotMapped]
            [NotMapped]
            public bool ActiveBool 
            { 
                get { return Active > 0; } 
                set { Active = value ? Convert.ToByte(1) : Convert.ToByte(0); } 
    
            } 
        } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a model that has a foreign key relation to another. I'd like
I have a model, Market that has a one-to-many relation to another model, Contract:
In relation to another question , how do you account for paths that may
I have a table that has a foreign key relation with another table. I
I created a new model in my rails app. Since it's a one-to-one relation
An user can post multiple comments in a thread, and I try to get
I'm designing a form where you need to add a relation to another object.
Im trying to update a table with data from another table, the relation between
I have a straightforward relation between two models: Asset and Update. both models (minus
This question is in relation to another question asked here: Sorting 1M records I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.