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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:57:33+00:00 2026-05-27T16:57:33+00:00

In some ORM’s if there is a one to many relationship the class representing

  • 0

In some ORM’s if there is a one to many relationship the class representing a table normally has a single object with the column’s name like ‘User’ and it populates the property with the contents of the matching table row.

For some reason Subsonic instead chose to add a property ColumnName with the letter s appended to it. It returns IQueryable instead of a single user object.

How do you go about filtering results based on some of the user’s properties?

I was trying to do something like this:

 FileRecord thumbnailImageRecord = newsArticleVersion.NewsArticleVersionFileMaps
            .SingleOrDefault(f => f.FileRecords.Single().FilePurpose == 3)
            .FileRecords.Single();

Is there a better way of doing this in the ORM or do I just have to use custom Linq?

  • 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-27T16:57:34+00:00Added an answer on May 27, 2026 at 4:57 pm

    This seems to be a shortcoming in SubSonic, and one worthy of a better solution.

    Currently one way to do it is to create a partial class of the same name as one of the generated ActiveRecord classes, and add a custom getter.

    public partial class child {
      public parent parent {
        get { return parent.SingleOrDefault(x => this.parent_id == x.id); }
      }
    }
    

    It should be possible to do this more efficiently by modifying the T4 file, if you have the courage!

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

Sidebar

Related Questions

I recently developed a class named DocumentWrapper around some ORM document object in Python
is there a way how to fully load some SQLAlchemy ORM mapped instance (together
I'm preparing some table names for an ORM, and I want to turn plural
I'm using __init__() like this in some SQLAlchemy ORM classes that have many parameters
Some Object Relational Mapping (ORM) frameworks (such as LLBLGen) allow you to specify predicate
The SQLAlchemy ORM tutorial uses this class: >>> from sqlalchemy import Column, Integer, String
I've been working with Doctrine 2 ORM for some time, and there's something I've
Has anyone seen this message before? There is some discussions on Hibernate forums with
I'm trying to use the Django ORM in some standalone screen scraping scripts. I
I am looking for some guideline for my new application while choosing ORM. I

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.