Closed grassit closed 4 years ago
The method AddInfrastructure is used in the Startup.ConfigureServices(): https://github.com/JasonGT/CleanArchitecture/blob/c1c3c97c0d105655b04e9023af7ac076a7b7f6a5/src/WebUI/Startup.cs#L37
The purpose of the DependencyInjection class in the Infrastructure project as I understood is to encapsulate the dependencies of one project in a single call (e.g. AddApplication, AddInfrastructure). Jason talks about this in his talk: https://youtu.be/5OtUm1BLmG0?t=1663
This is correct, I think it is a nice and simple approach to managing dependencies across layers using the built-in .NET Core DI.
In https://github.com/JasonGT/CleanArchitecture,
Startup.ConfigureServices()
insrc/WebUI/Startup.cs
registers services for dependency injection.AddInfrastructure()
insrc/Infrastructure/DependencyInjection.cs
also registers services. But is it correct that classDependencyInjection
and methodAddInfrastructure()
are not used in any other files? What are their purposes?Putting
services.AddContextDb()
inDependencyInjection.AddInfrastructure()
may have caused definition of 'UseSqlite' not found in https://github.com/JasonGT/CleanArchitecture/issues/52Thanks.