❔ Simple Api Fails to launch, why?

My Code:
uilder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddScoped<IRecordService, RecordService>();
builder.Services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("defaultConnection")));

var app = builder.Build();


My Error:
    System.AggregateException: 'Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Services.Interfaces.IRecordService Lifetime: Scoped ImplementationType: Services.Services.RecordService': Unable to resolve service for type 'Core.Interfaces.IRecordRepository' while attempting to activate 'Services.Services.RecordService'.)'

How do i fix this? whats the prblem?
Was this page helpful?