ASP.Core StructureMap容器

时间:2016-12-04 22:44:40

标签: asp.net-core structuremap

我是ASP.Core的新手。我们有一个项目,我们必须使用依赖注入和StructureMap。我想知道在以下方法中将Container放入StartUp.cs文件中是否是正确的方法。如果safeIHttpContextAccessor置于如下配置中,则为 public void ConfigureServices(IServiceCollection services) { Container container = new Container(expr => { expr.For<IDataContextService>().Use<DataContextService>(); expr.For<IHttpContextAccessor>().Use<HttpContextAccessor>(); expr.For<ISessionService>().Use<SessionService>(); }); services.AddSingleton<IContainer>(container); }

data(learning.test)
e1 = model2network("[A][B][C|A:B][D|B][E|C][F|A:E]")
e2 = model2network("[A][B][C|A:B][D|B][E|C:F][F|A]")

1 个答案:

答案 0 :(得分:2)

在ASP.NET核心中更改基本依赖关系容器时,ConfigureServices需要返回adb shell shell@gtexswifi:/ $ sm list-disks /system/bin/sh: sm: not found 127|shell@gtexswifi:/ $ 的实例

Andew Lock在他的博客post中向您展示了如何执行此操作。

从他的博客文章中得知,StructureMap

就是这样的
IServiceProvider

如果您对使用Autofac感兴趣,可以参考有关该主题的ASP.NET documentation

相关问题