public static List <ILinkInfo> GetAllNeuralNodesLinks(LinkType[] ignore = null) { List <ILinkInfo> res = new List <ILinkInfo>(); var ignoreLink = (bool)ignore?.Contains(LinkType.NeuralLink); if (!ignoreLink) { res.AddRange(DbLinkCollection.Find(x => true).ToList()?.Select(x => x as ILinkInfo).ToList()); } var ignoreAction = (bool)ignore?.Contains(LinkType.ActionLink); if (!ignoreAction) { res.AddRange(DbActionCollection.Find(x => true).ToList()?.Select(x => x as ILinkInfo).ToList()); } var ignoreResources = (bool)ignore?.Contains(LinkType.NeuralResource); if (!ignoreResources) { res.AddRange(DbResourceCollection.Find(x => true).ToList()?.Select(x => x as ILinkInfo).ToList()); } return(res); }
public static async Task <List <ILinkInfo> > GetAllLinks(this LinkType type) { List <ILinkInfo> res = null; switch (type) { case LinkType.NeuralLink: res = (await DbLinkCollection.Find(x => true).ToListAsync()).Select(x => x as ILinkInfo).ToList(); break; case LinkType.ActionLink: res = (await DbActionCollection.Find(x => true).ToListAsync()).Select(x => x as ILinkInfo).ToList(); break; case LinkType.NeuralResource: res = (await DbResourceCollection.Find(x => true).ToListAsync()).Select(x => x as ILinkInfo).ToList(); break; default: break; } return(res); }