We have a collection called Company with properties like name, address etc. Then we have a collection called CompanyBranch with properties:
public Guid CompanyId { get; set; } public string BranchName { get; set; } public Address Address { get; set; }
Where the id of the initial collection called "Company" will be stored in "CompanyId" property of the "CompanyBranch" collection.
There is a one to many relationship between company and companyBranch where 1 company can have multiple companyBranches.
The CompanyBranch app service code to create a companyBranch entity is as follows:
- SolutionName.Application/CompanyBranches
namespace SolutionName.CompanyBranches
{
private readonly ICompanyRepository _companyRepository;
private readonly ICompanyBranchRepository _companyBranchRepo;
private readonly CompanyBranchManager _companyBranchManager;
public CompanyBranchAppService(
ICompanyBranchRepository companyBranchRepo,
ICompanyRepository companyRepository,
CompanyBranchManager companyBranchManager)
{
_companyBranchManager = companyBranchManager;
_companyBranchRepo = companyBranchRepo;
_companyRepository = companyRepository;
}
#region CREATE
public async Task<CompanyBranchDto> CreateAsync(CreateUpdateCompanyBranchDto input)
{
var branch = await _companyBranchManager.CreateAsync(
input.BranchName,
input.CompanyId,
input.Address);
var companyBranchDto = ObjectMapper.Map<CompanyBranch, CompanyBranchDto>(branch);
companyBranchDto.CompanyName = await _companyRepository.FindByIdAsync(branch.CompanyId);
await _companyBranchRepo.InsertAsync(branch);
return companyBranchDto;
}
#endregion
}
The error response on executing the create api looks like this:
Trying to put the breakpoint I am not able to get any response from visual studio, the request just finishes with the error without pausing. Please let me know where the issue might be.
Thank you.
10 Answer(s)
-
0
hi. please update. thank you.
-
0
Hi,
Can you share the error stack? thanks.
-
0
Hi,
Can you share the error stack? thanks.
{ "userId": "dcf37353-fc1d-0bb5-e820-39fc86c50a1e", "userName": "admin", "tenantId": null, "impersonatorUserId": null, "impersonatorTenantId": null, "executionTime": "2021-06-01T07:19:20.16Z", "executionDuration": 5, "clientIpAddress": "::1", "clientName": null, "browserInfo": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36 Edg/90.0.818.66", "httpMethod": "POST", "url": "/api/app/company-branch", "exceptions": "", "comments": "", "httpStatusCode": 500, "applicationName": null, "correlationId": "6625a18b1f1747a7a1fdb7e7664ccfab", "entityChanges": [], "actions": [], "id": "e6ecd896-becd-ad49-8f8c-39fcd89dc565", "extraProperties": {} }
Please let me know if this is what you wanted. Thank you
-
0
Hi,
I mean the application error log : ).
-
0
Hi,
I mean the application error log : ).
Hi, Please find the below link to the log file in the httpapi.host project.https://commitme-my.sharepoint.com/:t:/g/personal/naeem_comm-it_com_sa/Eb8xKWHKJ6tNvmx3KaVc57gBPGpxCD6uEdzkBZM7sQz3cA?e=ZUXRHk
Thank you :)
-
0
hi, i hope you were able to get the file from the link.
-
0
-
0
-
0
Hi,
Maybe I can check it remotely. shiwei.liang@volosoft.com
-
0
ABP uses a naming convention to register DI.
Your repository name is
CompanyBRRepository
and it should beCompanyBranchRepository
Also, see: https://docs.abp.io/en/abp/latest/Dependency-Injection