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 7970767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:28:44+00:00 2026-06-04T07:28:44+00:00

I have the following problem: I have a table in the database called Person

  • 0

I have the following problem: I have a table in the database called Person which have all the relevant data such as first name, last name, date of birth, sex etc … . My question is : Is it possible to hide some of the attributes and if yes how can i achieve that. I need that because in my entity instead of date of birth I want an attribute called age which will take the date of birth and calculate the age. Also I want to hide another column called job which has default value N for no and also can be Y for yes. Instead of it I want to have the same column but with true or false. I know that I can achieve that changing the database but in my case I am not allowed to do that. And the last point: is there away to add additional columns which doesn’t have a representation in the database ..for example a computed one which takes the attribute salary and based on it (for example if it is more or less than 500 euros) calculates the bonuses ? Thanks 🙂

  • 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-04T07:28:45+00:00Added an answer on June 4, 2026 at 7:28 am

    Place your context and entities into a seperate project. The Person entity you’ve described could be done as follows:

    public class Person
    {
        public string FirstName { get; set; }
    
        public string LastName { get; set; }
    
        internal DateTime DateOfBirth { get; set; }
        [System.ComponentModel.DataAnnotations.Schema.NotMapped]
        public double AgeInYears { get { return DateTime.Now.Subtract(this.DateOfBirth).TotalDays / 365; } }
    
        public char Sex { get; set; }
    
        internal string Job { get; set; }
        [System.ComponentModel.DataAnnotations.Schema.NotMapped]
        public bool HasJob { get { return this.Job == "Y"; } }
    }
    

    Doing the above will only expose FirstName, LastName, AgeInYears, Sex, and HasJob to other projects, in the datatype you want.

    To add a column that doesn’t exist in the database, just use the appropriate Data Annotation as shown above.

    To hide a column, mark it as internal.

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database table called AllCustomersHistoryOfRecords which is table with history of all
The problem is the following, I have a table of friendships in my database,
I have a table in my database called Task. Task has the following fields:
i'm having a problem with my database. I have the folowing: create table book
I have the following problem. I have a table with a few hundred thousand
Greeting! I have the following problem. I have a table with huge number of
I'm new to wicket and stuck with the following problem: I have a table
I have the following loop which is giving me problems $(#divResults).append('<table>'); $.each( results.d, function(
Heres my problem. I have a mysql table called quotes. In one of the
I have a table called Recharge in a Access Database. Some of the fields

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.