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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:46:01+00:00 2026-06-08T02:46:01+00:00

I have a DB that was built with EF 4 code first, here’s two

  • 0

I have a DB that was built with EF 4 code first, here’s two models:

Public Class HvacAudit
    Public Property HvacAuditID As Integer

    Public Overridable Property HvacAuditPictures As IEnumerable(Of HvacAuditPicture)

    ... other properties
 End Class

Public Class HvacAuditPicture
    Public Property HvacAuditPictureID As Integer

    Public Property HvacAuditID As Integer
    Public Overridable Property HvacAudit As HvacAudit

    ... other properties
End Class

When I pull my HvacAudit records from the db, they don’t have HvacAuditPictures! Even though if I pull the pictures directly, they are there. Consider

context.HvacAudits.Where(Function(hva) hva.HvacAuditID = 1).HvacAuditPictures Is Nothing 'evaluates true

context.HvacAuditPictures.Where(Function(p) p.HvacAuditID = 1).Count() 'is currently 20

Here’s my context class:

Public Class EfContext
Inherits DbContext
Implements IDataSource

Public Property HvacAudits As IDbSet(Of HvacAudit) Implements IDataSource.HvacAudits
Public Property Vendors As IDbSet(Of Vendor) Implements IDataSource.Vendors
Public Property HvacAuditPictures As IDbSet(Of HvacAuditPicture) Implements IDataSource.HvacAuditPictures
Public Property Sites As IDbSet(Of Site)
Public Property Markets As IDbSet(Of Market)

Public Sub SaveChanges1() Implements Domain.DataSource.IDataSource.SaveChanges
    SaveChanges()
End Sub
End Class
  • 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-08T02:46:02+00:00Added an answer on June 8, 2026 at 2:46 am

    Found the answer. The navigation property for the “many” side of a relationship has to be an ICollection(Of T), not an IEnumerable(Of T).

    Public Class HvacAudit
        Public Property HvacAuditID As Integer
    
        Public Overridable Property HvacAuditPictures As ICollection(Of HvacAuditPicture)
    
       ... other properties
    End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Full and Lite applications that were built from the same code.
We have an underlying .h file in our platform code that needs built differently
I'm developing a system, and I have build a code generator that emits a
We have a team that built an agent in Mono using MonoDevelop on Mac
I have an editor that built as follows: EditorBuilder builder = context.Html.Telerik().Editor() .Name(ID) .Encode(false)
i have bought a template that have built in contact form problem is that
I have a project that is built and managed by Maven. I have a
I have an exe that is built and placed into a Setup project for
I have a website that I built a while ago. All of sudden, without
I have a project that when built from my machine everything runs smoothly. However,

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.