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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:27:02+00:00 2026-05-14T00:27:02+00:00

I have two tables that are related via a mapping table: keywords titles I

  • 0

I have two tables that are related via a mapping table:

  1. keywords
  2. titles

I am trying to return a list of Map_Keywords_Title (the mapping table’s object) based on the results of a join.

Until I added the last part with typedQuery it was just returning objects of anonymous type. I want it to return items of type Map_Keywords_Title so I tried adding the Select at the end (also tried Cast but that failed). The problem now is that the resulting objects are not managed by entity framework so I can’t save changes to them.

Is there no straightforward way to do this in Linq to Entities? I’m using VS2008 so I don’t yet have the new EF.

    public IList<Map_Keywords_Title> MatchingTitleKeywordMappings(string containedInText)
    {
        var keywords = QueryKeywords();
        if (!string.IsNullOrEmpty(containedInText))
        {
            Expression<Func<Keyword, bool>> exprContainsKeyword = k => containedInText.Contains(k.WordText);
            keywords = keywords.Where(exprContainsKeyword);
        }
        var maps = QueryMap_Keywords_Title();
        var anonQuery = keywords.Join(
            maps,
            key => (int)key.Id,
            map => (int)map.Keyword.Id,
            (key, map) => new
            {
                map.Id,
                map.Keyword,
                map.Title
            });
        var typedQuery = anonQuery.ToList().Select(anon => new Map_Keywords_Title()
            {
                Id = anon.Id,
                Keyword=anon.Keyword,
                Title=anon.Title
            });

        return typedQuery.ToList();
    }
  • 1 1 Answer
  • 3 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-14T00:27:02+00:00Added an answer on May 14, 2026 at 12:27 am

    Ok, I got tired of comments…

    using( someContext sc = new someContext())
    {
        sc.Map_Keywords_Title.Include("Title")
                    .Include("Keyword")
                    .Where( mkt => containedInText.Contains(mkt.Keyword.WordText));
    }
    

    Is that anywhere close to what you want?

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

Sidebar

Related Questions

I have two tables that are connected via a join table in a many-to-many
I have two tables that are indirectly related by another table TableA - ID,
I have two tables that need to be related--a users table and an address_book
I've got two tables that have related items through a connection-table. The connection table
I have two ( characteristic_list and measure_list ) tables that are related to each
I have two tables that are related to each other in a 1-1 relationship
I have a query that performs a UNION between two tables. I'm trying to
I have two tables, that relate via a one-to-many relationship i.e tableOne (1)----------(*) tableTwo
in my db I have two tables that are related. Lets call them Job
I have two tables in an existing (MSSQL 2008 R2) database that are related

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.