LINQ到Active Directory實現 自定義的LINQ查詢提供,允許在Active Directory中 查詢對象。 在內部,查詢被翻譯爲LDAP過濾器,它被髮送到 服務器使用 System.DirectoryServices .NET 框架庫。
http://www.codeplex.com/LINQtoAD
樣品(從網站):
// NOTE: Entity type definition "User" omitted in sample - see samples in release.
var users = new DirectorySource<User>(ROOT, SearchScope.Subtree);
users.Log = Console.Out;
var res = from usr in users
where usr.FirstName.StartsWith("B") && usr.Office == "2525"
select new { Name = usr.FirstName + " " + usr.LastName, usr.Office, usr.LogonCount };
foreach (var u in res)
{
Console.WriteLine(u);
u.Office = "5252";
u.SetPassword(pwd);
}
users.Update();
+1我發現這個職位,而不是! ;)Hehehe ... – 2010-02-25 17:11:55