Solved

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

Posted on 2017-01-25
2
56 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

628 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