Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do you do a one to many list in .NET CORE?

Posted on 2017-01-25
2
Medium Priority
?
74 Views
Last Modified: 2017-02-07
My task is pretty straightforward, but I don't know how to pull it off.

I need to run a list where I'm grabbing all of the individuals listed in one table and then all the activities those individuals do from another table. So, it looks like this:

table_1.individual_one
     table.2.individual_one_activity
     table.2.individual_one_activity
table_1.individual_two
    table.2.individual_two_activity
    table.2.individual_two_activity

It's your basic one to many relationship and while I know how to do it in another language, I'm new to .NET, hence the basic nature of my question.

The good news is that I'm working in the context of an app that's pretty verbose and is working very well, so I want to hope that I can just mimic some of what's already going on. I think I've found an example, but I would still like some input.

Here's what appears to be a basic list:

 public class DesignPro : Entity
    {
        public string DesignProID { get; set; }
        public List<DesignProD> DesignProfessionalD { get; set; }
    }

Here's what I'm thinking is something similar to what I need, but I don't completely understand it...

 public class DesignProfessionalDiscipline : Entity
    {
        public int DesignProfessionalDId { get; set; }
        public string DesignProLk { get; set; }
        public DesignProfessional DesignProfessional { get; set; }
        public string DisciplineLk { get; set; }
        public Discipline Discipline { get; set; }
        public List<DrawingDesignProfessionalDiscipline> DrawingDesignProfessionalDisciplines { get; set; }
    }

I see "DisciplineDiscipline" and I'm wondering if that's an embedded list of sorts.

Can someone point me in the right direction?
0
Comment
Question by:brucegust
2 Comments
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 41979898
To your statement, "I see "DisciplineDiscipline" and I'm wondering if that's an embedded list of sorts.", no that is not a list it is a single instance of Discipline.
0
 

Author Closing Comment

by:brucegust
ID: 41998837
This has since been resolved, Fernando, but thanks for weighing in!
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question