【发布时间】:2018-12-12 00:17:47
【问题描述】:
我正在使用角度反应形式的输入搜索字段来查找 AD 用户。因此,当您开始输入您的姓名时,您应该获得该字段的一些自动完成选项。为此,我从我的 Angular 应用程序中调用了一个 web api 方法,该方法又返回给我一个用户列表。我将该用户列表绑定到输入字段数据列表。我在我的网络 api 中使用以下代码:-
public List<string> ADUsers()
{
List<string> users = new List<string>();
using (var context = new PrincipalContext(ContextType.Domain, "abc.in"))
{
using (var searcher = new PrincipalSearcher(new UserPrincipal(context)))
{
foreach (var result in searcher.FindAll())
{
DirectoryEntry de = result.GetUnderlyingObject() as DirectoryEntry;
if(de.Properties["givenName"].Value != null && de.Properties["sn"].Value != null)
users.Add(de.Properties["givenName"].Value + " " + de.Properties["sn"].Value);
}
}
}
return users;
}
由于用户数量太多,将列表返回到 angular(20-25 秒) 需要时间,这反过来需要时间来反映在反应形式的输入字段中。我是 Angular 新手,基本上是 .net 开发人员。您能否提出一些方法来找出一些响应式解决方案?或者是否有可能在角度本身具有功能,以便我不应该为此调用 web api 方法?
【问题讨论】:
标签: c# angular active-directory angular7