Passing constructor arguments when using StructureMap

前端 未结 3 479
暗喜
暗喜 2020-12-03 09:24

I\'m using StructureMap for my DI. Imagine I have a class that takes 1 argument like:

public class ProductProvider : IProductProvider
{
     public ProductPr         


        
3条回答
  •  被撕碎了的回忆
    2020-12-03 10:13

    I found the answer myself! Here is the solution:

    ObjectFactory.With("connectionString").EqualTo(someValueAtRunTime).GetInstance();
    

    Hope this helps others who have come across the same issue.

提交回复
热议问题