Services.Add => 2 NuGet

If you make a NuGet package for ASP.NET Core  and you make an extension method that calls

Services.AddWhatever

in order to add a Sngleton / Scoped / Transient a

IWhatever =>  Whatever

implementation,please add IWhatever in a separate Nuget .

Why ? Because not all ASP>NET Core projects are made of a single project – and,if someone needs constructor injection with IWhatever in his Business Logic,he must not be forced to add the whole asp.net dependencies for just a IWhatever interface

 

Example: The https://www.nuget.org/packages/Lib.AspNetCore.ServerTiming/   –   it depends upon Microsoft.AspNetCore.Http . But I want just  IServerTiming in a business logic. I do not need also the dependency of  IApplicationBuilder .

( and yes,I have started an issue: https://github.com/tpeczek/Lib.AspNetCore.ServerTiming/issues/19 )


Posted

in

, ,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *