Prerequisites
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
- What is your product version? 9.11
- What is your product type (Angular or MVC)? Angular
- What is product framework type (.net framework or .net core)? .net core
Hi,
How can I create many-to-many relationship DTO? In other words, I can't find any good example.
I have followed EF Core examples and I have already created two Entity tables and one intermediary table.
The question is: how do I properly create DTO objects for Selecting, Editing, Inserting of these entities, and their relationships.
Can you please point to an example?
Thank you!
Edit: maybe you can point me out to an example in aspnetboilerplate or asp.net zero where many-to-many is implemented/used?
8 Answer(s)
-
0
Hi Tkorytnyuk, In the ABP framework source code, roles and users are a typical example, you can read the relevant source code. Each project corresponds to multiple people, the following is an example.
public class PersonDto { public string Name { get; set; } public int Age { get; set; } } public class ProjectCreateOrUpdateDto { public string Name { get; set; } public string Description { get; set; } public List<long> PersonIds { get; set; } } // Details Dto public class ProjectDto { public string Name { get; set; } public string Description { get; set; } public List<PersonDto> Persons { get; set;} }
if you need,I will upload the demo file as an attachment tomorrow.
-
0
thanks, zony. I'll be waiting.
-
0
Any updates @zony?
-
0
Hi Tkorytnyuk, Due to the recent busy schedule, I will upload the corresponding attachments on October 1st.
-
0
-
0
Hi thank you, but where is the zip file?
-
0
Hi @Tkorytnyuk
We will upload the zip file in a short time. You can also try new Power Tools with latest version of AspNet Zero and crete a new mster-detial sample to see such a relationship.
-
0
Hi Tkorytnyuk, Sorry, I missed the zip file, I have re-uploaded it. https://1drv.ms/u/s!AhvCnUPNy3pUgY5VPlbVbanmF7aqQw?e=zSfCtf