Question regarding Microsoft's documentation about .NET Core and inheritance
On this MS documentation page, they set up an interface IMyDependency and another class that implements that interface, MyDependency.
A few scrolls in it then says this:
IMyDependency ... must be registered in the service container.
and then proceeds to have a code sample of:
services.AddScoped<IMyDependency, MyDependency>();
I'm not understanding why you need to provide a link between the interface and the concrete class? I understand the concept of inheritance and I know the inheritance will work without this 'linking'. So what is the benefit of this linking?
0 comments:
Post a Comment