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

How to inject the interface only with class string name in the runtime

$
0
0

E.g. have an interface IFoo, know that only one class implements IFoo and the classstring name is "AAAA".  

How to inject this scenario in startup.cs?

Seems like we can do like:

services.AddTransient(typeof(IFoo), Type.GetType("AAAA", fullNameSpace));

But is this the good idea?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



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