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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:21:09+00:00 2026-05-29T07:21:09+00:00

I’m using a many-to-many database with join tables connecting main data tables through foreign

  • 0

I’m using a many-to-many database with join tables connecting main data tables through foreign keys.

http://img12.imageshack.us/img12/6500/databasew.png

With my data representation, it’s required to concatenate several rows of subordinate table fields (e.g. Genres.name) into one cell of the databound grid.

Book Title | Genres

Some Book | fiction; horror; mystery


With the dataset I used this SQL query with GROUP_CONCAT for this purpose:

SELECT Books.ID, Books.BOOKTITLE, GROUP_CONCAT(Genres.name, '; ') As Gen

FROM   Books INNER JOIN

       Books_Genres ON Books.ID = Books_Genres.book_id INNER JOIN
       Genres ON Books_Genres.genre_id =Genres.id

GROUP BY Books.ID

As I’m now moving on to EF4 and being pretty new to it, I have no idea how to achieve the same resulting table that could be displayed in a datagrid with entities. What kind of changes should be made to the Entity model to get the same result?

Any help greatly appreciated!


Update:

I have an entity model generated by database (Model1.edmx & Model1.Designer.cs). Do I need to edit the Model1.edmx (xml file)? A few step by step instructions would greatly help. I’m just starting EF4, it’s all Greek to me. 🙂

I made a custom class:

public partial class Book {
        [EdmScalarProperty(EntityKeyProperty = false, IsNullable = true)]
        [DataMember()]
        public global::System.String GenresConcatenated
        {
            get { return string.Join("; ", Genres.Select(g => g.name));}
            set {}
        }
        private List<Genre> Genres{ get; set; }
     }

Now I can access the property GenresConcatenated in IDE IntelliSense, but when I run the application it throws the error:

The number of members in the conceptual type ‘MyNamespace.Book’ does
not match with the number of members on the object side type
‘MyNamespace.Common.Book’. Make sure the number of members are the
same.

It looks like:

… EntityDataSource does not support custom properties in the partial
classes. It only returns the entity that is in the model.
(Binding custom property in Entity Framework)

So I’m back to square one. 🙂

  • 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-29T07:21:10+00:00Added an answer on May 29, 2026 at 7:21 am

    How about,

    class Book 
    { 
        public int ID { get; set; } 
        public string Title { get; set; } 
        public List<Genre> Genres { get; set; }
    
        public string Gen
        {
            get
            {
                return string.Join("; ", Genres.Select(g => g.Name));
            }
        }
    }
    

    then bind to Book.Gen (or whatever you want to name it)

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

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.