我有ADAM建立&我編寫的Web服務來完成管理任務,如添加新用戶等。(我有使用同一ADAM實例的多個應用程序)ADAM - 有沒有辦法「存儲」應用程序特定的屬性?
我所試圖實現可能會聽起來有點奇怪 - 但基本上我希望管理員用戶能夠選擇Web服務應從ADAM返回的屬性。例如。應用程序1應返回displayName & telephoneNumber,但應用程序2可能不需要返回相同的屬性。
目前我已經建立了一個SQL Server表,用於存儲用戶選擇返回哪些屬性&然後在Web服務循環中通過它加載所需的屬性並將結果添加到要返回的數組中(If你的興趣我會在底部添加代碼)。
我想知道是否有更好的方法來做到這一點? ADAM本身可以存儲這樣的東西嗎?
在此先感謝您的幫助!
//using linq to access table
DataClasses1DataContext db = new DataClasses1DataContext();
var queryAttributes = from atr in db.AttributesToReturns
where atr.appNumber == appNumber
select atr;
ArrayList userD = new ArrayList();
foreach (var a in queryAttributes)
{
//the col 'attribute' contains the exact name in active direct e.g. displayName
string att = a.attribute.ToString();
searcher.PropertiesToLoad.Add(att);
}
//--code omitted but here perform search & get req Directory Entry
foreach (var a in queryAttributes)
{
string attributeName = a.attribute.ToString();
try
{
string value = user.Properties[attributeName].Value.ToString();
//do something with value - here i am updating a user object which will be added to the ArrayList the webservice is returning
updateUser(u, attributeName, value);
}
//if an error - just set value to empty
catch (Exception ex)
{
string value = "NULL";
updateUser(u, attributeName, value);
}
}
userD.Add(u);
人,顯然這不是專門針對我執導畢竟:( – 2009-06-29 14:14:25