2
我剛剛開始使用Castle Windsor的Fluent註冊,並無法弄清楚如何引用我在XML的屬性部分中定義的屬性配置文件註冊時。所以我有這個代碼來註冊一個組件。Castle Windsor Fluent API:如何將組件參數值設置爲配置的屬性
RegisterComponent(componentId, Component.For<ConnectionConfig>()
.ImplementedBy(typeof(ConnectionConfig))
.Named(componentId)
.LifeStyle.Singleton
.Parameters(
Parameter.ForKey("ConnectionId").Eq(connectionId),
Parameter.ForKey("CommandTimeoutSeconds").Eq("#{ConnectionInfo.DefaultTimeout}")));
的#{ConnectionInfo.DefaultTimeout}是我在被裝載到之前的流利註冊的容器中的XML配置定義的屬性,但是這不工作,在該代碼中的參數傳遞給等式()被視爲一個文字(雖然這適用於其他組件,例如$ {My.Component}將起作用)
任何想法如何通過新的Fluent API註冊組件時從我的配置文件引用屬性?
感謝