0
在WCF客戶端啓動之後讓WCF主機訪問多個數據庫而不傳遞名稱的最佳方式是什麼?我使用DI和想要做的事,如:一個WCF服務和多個數據庫連接
wcfCourseManagement.CourseManagementClient _wcfclient = null;
public WCFCourseRepository(ISystemService systemService): base(systemService)
{
_wcfclient = new wcfCourseManagement.CourseManagementClient();
ServiceEndpoint endpoint = systemService.GetServiceEndpoint("CourseManagement");
if (endpoint != null)
_wcfclient.Endpoint.Address = new EndpointAddress(new Uri(endpoint.Endpoint));
if (_wcfclient.GetRemoteSystemID != systemService.ClientSystem.PreferredRemoteSystemID)
_wcfclient.SetCurrentSystem(systemService.ClientSystem.PreferredRemoteSystemID);
}
的SetCurrentSystem會告訴WCF主機,它應該重建數據倉庫如果需要的話。系統ID只是一個ID,存放在服務器用來加載數據庫配置信息的配置存儲中。但是,由於WCF主機接線的設計,在主機的無參數構造期間注入了「默認」SystemID。我想覆蓋它,但是我不希望在每次調用時都傳遞它,因爲這會破壞當前的存儲庫接口,由客戶端和服務器代碼共享。什麼是完成這種行爲最直接的方式?
謝謝,看起來像一個偉大的文章。 – kgc 2011-06-14 21:17:27