I have a StructureMap container already set up (in a separate project) like so:
public class Container
{
public static StructureMap.Container Current { get; private set; }
public static void InitIoC()
{
var container = new StructureMap.Container(
c =>
{
c.For<AppSettings>().Singleton();
c.For<ILogger>().Use<Logger>();
c.For<IReminderService>().Use<ReminderService>();
...
}
}
}
I would like this configuration to be used in .NET Core 2.0 Web API.
In my Startup.cs I have to do this to make it work:
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.Add(ServiceDescriptor.Transient(typeof(ILogger), typeof(Logger)));
... // rewriting what is already configured
}
How can I simply inject this same configuration into WebAPI?