Skip to content

Conversation

@TwilightSaw
Copy link

No description provided.

Start of the project, added based files and functionalities.
Added various functionalities, fixes, validations and others.
Added another repository version
Finished the project, completely implemented second repository to use, added image folder and README
Copy link

@chrisjamiecarter chrisjamiecarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @TwilightSaw 👋,

Excellent work on your ExerciseTracker project submission 🎉!
I have performed a peer review and have added some praise and suggestions as bespoke comments.


I will go ahead and mark as approved, keep up the excellent work on the next projects! 😊

Best regards,
@chrisjamiecarter 👍

.AddJsonFile("appsettings.json")
.Build();

new Menu(new ExerciseController(new ExerciseService(new ExerciseRepository<Exercise>(context),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Optimizing for a Dependency Injection Framework

💡 In a modern DI setup, you would typically register services with the DI container in a ConfigureServices method or equivalent during application startup. For example:

services.AddDbContext<AppDbContext>(options => 
    options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));

services.AddScoped<IExerciseRepository<Exercise>, ExerciseRepository<Exercise>>();
services.AddScoped<IExerciseService, ExerciseService>();
services.AddScoped<IExerciseDapperRepository<Exercise>, ExerciseDapperRepository<Exercise>>();
services.AddScoped<IExerciseController, ExerciseController>();

Then resolve the top-level service (Menu) through the DI container:

using var scope = app.Services.CreateScope();
var menu = scope.ServiceProvider.GetRequiredService<Menu>();
menu.AddMenu();

This approach:

  • Removes the need for manual dependency management.
  • Promotes scalability and testability.
  • Simplifies code by letting the DI container handle lifecycle management.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants