Hi, In the step-by-step tutorial, "Creating PhoneBook Component"/"Creating Person Application Service, the PersonAppService class inherits the classes PhoneBookDemoAppServiceBase and IPersonAppService. Both have not been created in the tutorial.....
Should these be GetPeopleInput and PersonListDto instead? These have been created in the steps before?
public class PersonAppService : PhoneBookDemoAppServiceBase, IPersonAppService { private readonly IRepository<Person> _personRepository;
public PersonAppService(IRepository<Person> personRepository)
{
_personRepository = personRepository;
}
public ListResultDto<PersonListDto> GetPeople(GetPeopleInput input)
{
var people = _personRepository
.GetAll()
.WhereIf(
!input.Filter.IsNullOrEmpty(),
p => p.Name.Contains(input.Filter) ||
p.Surname.Contains(input.Filter) ||
p.EmailAddress.Contains(input.Filter)
)
.OrderBy(p => p.Name)
.ThenBy(p => p.Surname)
.ToList();
return new ListResultDto<PersonListDto>(ObjectMapper.Map<List<PersonListDto>>(people));
}
}
10 Answer(s)
-
0
Hi @bartkoolhaas https://docs.aspnetzero.com/en/aspnet-core-mvc/latest/Developing-Step-By-Step-Core-Creating-Person-Application-Service has
IPersonAppService
PhoneBookDemoAppServiceBase is a class that all zero project has. You can check your own one. It has following naming pattern:
[YOURAPPNAME]AppServiceBase
see https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Application/AbpZeroTemplateAppServiceBase.cs -
0
Aaaaaahhh, apologies, i did do this. Visual Studio says "The type or namespace name 'IPersonAppService' could not be found, and it then gives me 3 options "Generate interface 'IPersonAppService' in new file, Generate interface 'IPersonAppService', or Generate new type... What should I do here?
-
0
I fixed those, it still cannot find the respective classes...
The errors it gives are as follows:
Severity Code Description Project File Line Suppression State Error CS0246 The type or namespace name 'PhoneBookDemoAppServiceBase' could not be found (are you missing a using directive or an assembly reference?) Acme.PhonebookDemo.Application C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\src\Acme.PhonebookDemo.Application\PhoneBook\PersonAppService.cs 16 Active Error CS0246 The type or namespace name 'IPersonAppService' could not be found (are you missing a using directive or an assembly reference?) Acme.PhonebookDemo.Application C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\src\Acme.PhonebookDemo.Application\PhoneBook\PersonAppService.cs 16 Active Error CS0006 Metadata file 'C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\src\Acme.PhonebookDemo.Application\bin\Debug\net5.0\ref\Acme.PhonebookDemo.Application.dll' could not be found Acme.PhonebookDemo.Test.Base C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\test\Acme.PhonebookDemo.Test.Base\CSC 1 Active Error CS0006 Metadata file 'C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\src\Acme.PhonebookDemo.Application\bin\Debug\net5.0\ref\Acme.PhonebookDemo.Application.dll' could not be found Acme.PhonebookDemo.Web.Core C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\src\Acme.PhonebookDemo.Web.Core\CSC 1 Active Error CS0006 Metadata file 'C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\src\Acme.PhonebookDemo.Application\bin\Debug\net5.0\ref\Acme.PhonebookDemo.Application.dll' could not be found Acme.PhonebookDemo.GraphQL.Tests C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\test\Acme.PhonebookDemo.GraphQL.Tests\CSC 1 Active Error CS0006 Metadata file 'C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\test\Acme.PhonebookDemo.Test.Base\bin\Debug\net5.0\ref\Acme.PhonebookDemo.GraphQL.Test.Base.dll' could not be found Acme.PhonebookDemo.GraphQL.Tests C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\test\Acme.PhonebookDemo.GraphQL.Tests\CSC 1 Active Error CS0006 Metadata file 'C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\src\Acme.PhonebookDemo.Application\bin\Debug\net5.0\ref\Acme.PhonebookDemo.Application.dll' could not be found Acme.PhonebookDemo.Tests C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\test\Acme.PhonebookDemo.Tests\CSC 1 Active Error CS0006 Metadata file 'C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\test\Acme.PhonebookDemo.Test.Base\bin\Debug\net5.0\ref\Acme.PhonebookDemo.GraphQL.Test.Base.dll' could not be found Acme.PhonebookDemo.Tests C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\test\Acme.PhonebookDemo.Tests\CSC 1 Active Error CS0006 Metadata file 'C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\src\Acme.PhonebookDemo.Application\bin\Debug\net5.0\ref\Acme.PhonebookDemo.Application.dll' could not be found Acme.PhonebookDemo.Web.Host C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\src\Acme.PhonebookDemo.Web.Host\CSC 1 Active Error CS0006 Metadata file 'C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\src\Acme.PhonebookDemo.Web.Core\bin\Debug\net5.0\ref\Acme.PhonebookDemo.Web.Core.dll' could not be found Acme.PhonebookDemo.Web.Host C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\src\Acme.PhonebookDemo.Web.Host\CSC 1 Active Error CS0006 Metadata file 'C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\src\Acme.PhonebookDemo.Application\bin\Debug\net5.0\ref\Acme.PhonebookDemo.Application.dll' could not be found Acme.PhonebookDemo.Web.Public C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\src\Acme.PhonebookDemo.Web.Public\CSC 1 Active Error CS0006 Metadata file 'C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\src\Acme.PhonebookDemo.Web.Core\bin\Debug\net5.0\ref\Acme.PhonebookDemo.Web.Core.dll' could not be found Acme.PhonebookDemo.Web.Public C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\src\Acme.PhonebookDemo.Web.Public\CSC 1 Active Error CS0305 Using the generic type 'ObjectMapper<TSource, TDestination>' requires 2 type arguments Acme.PhonebookDemo.Application C:\Users\Bart Koolhaas\Documents\Visual Studio Projects\PhoneBookDemo\aspnet-core\src\Acme.PhonebookDemo.Application\PhoneBook\PersonAppService.cs 40 Active