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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:19:25+00:00 2026-06-09T01:19:25+00:00

I have two table called Project and ProjectComments on my database. I mapped them

  • 0

I have two table called Project and ProjectComments on my database.

I mapped them these two tables to my Entity Framework Model with generator.

Each project have many ProjectComments. I don’t want to add ProjectComments as a navigation property to Project because i want to write a GetProjectComments function to Project class.

Btw i can make desicion in GetProjectComments function for IsDeleted column of ProjectComments table. Because i don’t really delete any rows from ProjectComments table, i only make its IsDeleted = true if i need to delete, thus i shouldn’t return ProjectComments whose IsDeleted = true in GetProjectComments function.

It’s okay up to now. The problem is that in GetProjectComments function of Project class i need provider(context object) as parameter to call SaveChanges method of the same provider.

Is there any method to make these approach without asking provider object as a parameter in GetProjectComments function. Am i doing something wrong??

Looking for you reply. Thanks a lot.

  • 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-09T01:19:28+00:00Added an answer on June 9, 2026 at 1:19 am

    Easier :

    Add a ProjectComments navigation property in Project class (well let the generator do the job)

    Add a new property in a partial “Project” class

    public IEnumerable<ProjectComments> LivingComments {
       get {
          return this.ProjectComments != null 
             ? this.ProjectComments.Where(m => !m.IsDeleted) 
             : null;
       }
    }
    

    EDIT
    or as danludwig stated

    public IEnumerable<ProjectComments> GetLivingComments() {
         return this.ProjectComments != null 
             ? this.ProjectComments.Where(m => !m.IsDeleted) 
             : null;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a database called Poll and have these two table structures. poll
I Have a database called 'lms' with two tables loan and value, table loan
I have two tables called A and B . Table A contains request details
I have two table in my database. One called person and one called team.
Example: I have two tables in my database called classA and classB , and
I have a table called ProjectRegion. It has two columns, an id and a
I have a table called notification , with two columns: provider email The values
I am using MYSQL and PHP. I have a table called item. Two of
I have implemented inheritance for two parent classes called Table and Field . Each
I have a table, called Prices composed of a few fields, two of which

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.