0

If I have a web project which has interfaces and then I have different projects with implementation then I need to reference each of these different projects to be able to include the concrete class in the ConfigureServices method of Startup file.

E.g.

public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
            services.AddScoped<IAccountValidationService, CISValidationService>();
        }

Is this correct, so if I have loads of services then my main web project is going to need to reference each and every one of them.It just feels like it's going against the principle of me just using the interface? Or am I missing the point? Thanks for any help

Blingers
  • 789
  • 1
  • 9
  • 22
  • Also, this isn't possible anyway because the implementation project needs to reference the web project to use the interface so this would create a circular reference? – Blingers Oct 26 '18 at 12:54
  • I think it's better to separate in other static class. You can create a `IServiceCollection` and user in the `ConfigureServices`. This class only contains the classes that you want to using (Probably Business Logic Interfaces or Core Classes you need to inject). – Simon Restrepo Oct 26 '18 at 17:10

0 Answers0