Resources parent-child relationship to how we acquire
a company has multiple employees.
employee should not be exposed to api, it should reflect the relationship between the Company and the Employee.
Create a form EmployeesController plural.
Inherit ControllerBase, and two injection Repository
if the injection is empty throwing exceptions
we need to expose Employee in the company below, it is necessary to reflect the relationship between the URI by their
new Dto
field has made some adjustments
Creating Profiles
dto inside the name, the type of which the source mode FirstName + LastName
controller
DbContext inside initialized data, only had to add a company, where the employees plus data also
are running, we do seed data when the data is added directly to the Employees of the Company may not be there. Seed want to do Employee data must be used separately Employee
must develop its foreign key CompanyId can.
Seed data separately add the Employee.
And it is set to CompanyId Company Id above is consistent with
the Employee Id Guid type is also required us to manually assignment.
Adding migration
Test run the program
again to check the company's employees
dto fields are displayed.
End