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

  • SEARCH
  • Home
  • 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 6124803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:10:28+00:00 2026-05-23T16:10:28+00:00

i am working on a legacy enterprise database that uses multiple columns to retrieve

  • 0

i am working on a legacy enterprise database that uses multiple columns to retrieve a part number the sql we currently use checks for a part number and if the part number is null then checks for the child part number what would be the best way of combining this logic into a single ef model property (eg Product.PartNumber )

I would like this to be invisible as possible so that only PartNumber is visible externally to the data api

  • 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-05-23T16:10:29+00:00Added an answer on May 23, 2026 at 4:10 pm

    in theory couldnt you do something like this

    public class Part
    { 
        public string PartNumber
        {
            get
            {
                return this.PartId ?? this.ChildPartId;
            }  
        }
    
        internal string PartId { get; set; }
        internal string ChildPartId { get; set; }
    }
    
    
    
    public class PartsContext : DbContext
    { 
        public DbSet<Part> Parts { get; set; }
    
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Part>().Ignore(e => e.PartNumber);   
            base.OnModelCreating(modelBuilder);
        }
    }
    

    or is this still considered bad

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

Sidebar

Related Questions

We are working with a legacy database that uses SQL server uniqueidentifier columns for
Im working on a legacy database, that cant be changed. I have a table
I'm working with legacy code that uses some convoluted logic to bind IN and
I'm working with some legacy code that makes extensive use of this kind of
I'm working on a legacy project that has heavy use of Singletons. While most
I am working on a legacy jsp web application that uses JDBC and inline
I am working on a legacy Java Enterprise server project, and currently I am
I'm working with a legacy database with columns such as item and desc (for
I'm working with a legacy application that makes some use of the well-known/dreaded data
I'm working with a legacy database that stores a boolean column as a string,

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.