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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:58:00+00:00 2026-06-01T03:58:00+00:00

My table structure looks like : Account AccountId LoginName EmployeeId – nullable Employee FirstName,

  • 0

My table structure looks like :

Account
 AccountId
 LoginName
 EmployeeId - nullable
Employee
  FirstName,
  SecondName,
  etc..

I have query :

   var data = from o in _accountRepository.AsQueryableWithIncludes(x => x.Employee, x => x.Permissions)
               select new AccountGridVM
               {
                   AccountId = o.AccountId,
                   EmployeeFirstName = o.EmployeeId == null ? String.Empty: o.Employee.FirstName,
                   LoginName = o.LoginName,
                   Permissions = o.Permissions.Select(s => s.NameCZ)
               };
    return View(new GridModel { Data = data });

My problem is in tenar operator in EmployeeFirstName, entity framework always fetch only accounts, which has employeeId assign, but i need fetch all accounts.

If i remove EmployeeFirstName propeprty, ef fetch all rows.

Where is problem?

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-01T03:58:02+00:00Added an answer on June 1, 2026 at 3:58 am

    Problem solved. I had mistake in mapping.

      //bad
      HasRequired(x => x.Employee).WithMany().HasForeignKey(x => x.EmployeeId); // inner join
    
      //good
      HasOptional(x => x.Employee).WithMany().HasForeignKey(x => x.EmployeeId); // left join
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table structure that looks like this: Columns: Account Number Service Code
I have a simple table maintaining messages between users. The table structure looks like
I currently have a table structure that looks something like this(some details omitted): ColumnName
I have a bag whose structure looks like this: <bag name=foo fetch=select table=table_of_foos> <key
I have a structure that looks like this: <div class=project_group> <table> <tr style=display:none> <td>...</td>
I have a table structure that looks like: <table> <tr id=row1> <td> <div>row 1
I have three tables: Campus Building Floor and table structure is looks like this:
I have a sql table in my database accounts whose structure looks like this.
I have an existing table structure that looks something like this: AnimalTable ------------- |Id
I inherited an interesting table structure. This table structure looks like the following: GroupTable

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.