Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

How to inject the Construtor with string and interface parameters in ASP.NET 5.0

$
0
0

I have a constructor like the below:

public JITService(string baseAdress, IHttpClientProvider    clientProvider)
 {
 }

For only one interface as parameter, can inject in Startup.cs like:

 services.AddTransient<IHttpClientProvider,HttpClientProvider>();

For only one string as paramener, can inject like:

services.AddTransient<IJITService,JITService>((_)=>newJITService(""));

I do know how to do by third part like StructureMap:

config.For<IJITService>().Use<JITService>().Ctor<string>("baseAdress").Is(_JITService);

But how to do in ASP.NET 5.0 project? Thanks in advance.


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>