Ninject syntax for “Bind” with multiple arguments

后端 未结 1 1822
闹比i
闹比i 2021-01-03 22:40

How I can use multiple parameters in Ninject syntax like following?

Bind()
.To()
.WithConstructorArgument(\"conn         


        
1条回答
  •  孤城傲影
    2021-01-03 23:07

    You can chain the calls to WithConstructorArgument:

    Bind()
        .To()
        .WithConstructorArgument("connectionString", ConfigurationManager.ConnectionStrings["MyDb"].ConnectionString)
        .WithConstructorArgument("timeout", 10000);
    

    0 讨论(0)
提交回复
热议问题