• 1.1k
  • 1.4k
  • 55.8k

Interface with create web api

Jan 3 2022 10:15 AM

I have create a web api using Interface but I have a issue .

Severity    Code    Description    Project    File    Line    Suppression State
Error    CS0311    The type 'WebApiEF.EmpServices.EmpServices' cannot be used as type parameter 'TImplementation' in the generic type or method 'ServiceCollectionServiceExtensions.AddScoped<TService, TImplementation>(IServiceCollection)'. There is no implicit reference conversion from 'WebApiEF.EmpServices.EmpServices' to 'WebApiEF.Services.IEmployeeService'.    WebApiEF 12 Active

builder.Services.AddScoped<IEmployeeService, EmpServices>();  - Note I have use visual studio 2022 here not startup.cs file so I have add this line in program.cs 

Answers (1)