【发布时间】:2020-04-28 10:19:07
【问题描述】:
我在 autofac 中写了以下寄存器类型:
builder.RegisterType<NoteBookContext>()
.As<DbContext>()
.WithParameter(ResolvedParameter.ForNamed<DbContext>("connectionstring"));
事实上,我编写这段代码是为了使用连接字符串参数注入 NoteBookContext。 (即:new NoteBookContext(string connectionstring))
现在,如何在运行时传递参数值?
【问题讨论】: