Base solution for your next web application
Open Closed

Compile error after creating an {Entity}AppService with self referencing #6905


User avatar
0
IBTG created

Hello,

we have a Entity with a self reference. Unfortnatly the generator generates two fields und ctor-parameters for the repository with the same name and type. Additionaly there are multiple duplicate usings with the same namespace. Is it possible to distinct the Types before they are added to the class?

Error Example:

private readonly IRepository<Struktur, Guid> _strukturRepository;
private readonly IStrukturenExcelExporter _strukturenExcelExporter;
private readonly IRepository<Struktur, Guid> _strukturRepository; //wrong

public StrukturenAppService(IRepository<Struktur, Guid> strukturRepository, IStrukturenExcelExporter strukturenExcelExporter , IRepository<Struktur, Guid> strukturRepository)
  {
//the last parameter is a duplicate of the first one
[...]

Part from the MainTemplate.txt of the AppServiceClass: I think the two yellow parts ({{NP_Looped_Declaration_Here}} and {{NP_Looped_Ctor_Parameter_Here}}) should not include the Repository for the own Type ({{Entity_Name_Here}})


1 Answer(s)
  • User Avatar
    0
    yekalkan created

    I've created an issue https://github.com/aspnetzero/aspnet-zero-core/issues/2365