StructureMap HowTo: Conditional Construction on Deep Object

后端 未结 1 1766
Happy的楠姐
Happy的楠姐 2021-01-20 08:43

I\'m having difficulty conditionally creating a dependency. Googling, I have yet to find a good example of using the BuildStack and Conditional Predicates.

Here\'s

1条回答
  •  轮回少年
    2021-01-20 09:31

    It's often best to try to avoid conditional construction with that syntax, it is much harder to interpret than the For - Use. Your scenario can be solved using:

            For().Use().Ctor().Is();
            For().Use().Ctor().Is();
    
            For().Use();
    
            Scan(
                s =>
                {
                    s.TheCallingAssembly();
                    s.WithDefaultConventions();
                }); 
    

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