2
我有一個ConfigurationReader
類,我嘗試使用StructureMap或AutoFac進行連接(我還沒有確定要使用哪個容器) 。StructureMap/Autofac:如何基於web.config設置創建對象
public class ConfigurationReader {
private string _filePath;
public ConfigurationReader(string filePath){
this._filePath = filePath;
}
public IList<Baz> ListStuff(){
//do something with _filePath;
}
}
有將1..1基於應用程序的配置該類的實例(web.config文件將包含文件的分隔列表)。我正在尋找一個IoC容器中的擴展點,這將允許我利用它們來創建ConfigurationReader
的實例。
我想*這裏有一個錯誤,它涉及到一個lambda訪問你的foreach循環的變量。 –
你是對的,如果問題改變爲本地參考。我會改變它。 –
現在看起來不錯。 –