我在Silverlight中使用複合應用程序庫,並且需要將三個「區域」添加到我的區域。這些「區域」都具有基本相同的觀點和表達模式。 (我從StockTraderRI應用程序中得到這些單詞,糾正我,如果我錯了。)我唯一的區別是我從哪裏得到數據,所以我想爲每個「區域」有不同的服務。使用複合應用程序庫註冊與不同服務的相同視圖
目前,我能夠通過這樣做來初始化我的觀點在「RightsRegion」:
public void Initialize()
{
RegisterViewsAndServices();
this.regionManager.Regions["MainRegion"].Add(new DefaultViewUI());
this.regionManager.RegisterViewWithRegion("RightsRegion",() => container.Resolve<ISecurityTreePresentationModel>().View);
}
private void RegisterViewsAndServices()
{
container.RegisterType<ITreeViewService, EntityTypesService>(new ContainerControlledLifetimeManager());
container.RegisterType<ISecurityTreeView, SecurityTreeView>();
container.RegisterType<ISecurityTreePresentationModel, SecurityTreePresentationModel>();
}
我想我能夠用我的LocationsService登記在「RightsRegion」這一觀點的另一個副本,但似乎覆蓋我的EntityTypesService。
如何將三個相同的視圖和非常相似的演示模型註冊到我的「RightsRegion」中,以便他們各自使用不同的服務?
謝謝您的解答和建議。這有助於我現在走,並知道我應該走向何方。 – 2009-09-04 12:52:09