/// <summary> /// Search /// </summary> /// <typeparam name="T"></typeparam> /// <param name="profile"></param> /// <param name="callerId"></param> /// <returns></returns> public T Search <T>(T profile, Guid?callerId = null, bool isAdmin = false) where T : Profile, new() { if (null == profile) { throw new ArgumentNullException("profile"); } if (Guid.Empty == profile.Identifier && string.IsNullOrWhiteSpace(profile.Key)) { throw new ArgumentException("Not unique"); } callerId = !callerId.HasValue || callerId.Value == Guid.Empty ? (Guid?)null : callerId.Value; var sp = new UserSearchProfile() { Identifier = profile.Identifier == Guid.Empty ? (Guid?)null : profile.Identifier, Key = profile.Key.TrimIfNotNull(), Top = 1, CallerIdentifier = isAdmin ? AdministratorIdentifier : callerId, }; return(sp.Execute().LoadObject <T>()); }
public IEnumerable <T> Search <T>(string searchTerm, Guid?userId = null, Guid?callerId = null, bool isAdmin = false, short top = 100, int?radius = null) where T : Profile, new() { callerId = !callerId.HasValue || callerId.Value == Guid.Empty ? (Guid?)null : callerId.Value; userId = !userId.HasValue || userId.Value == Guid.Empty ? (Guid?)null : userId.Value; var proc = new UserSearchProfile() { Keyword = string.IsNullOrWhiteSpace(searchTerm) ? null : searchTerm, ConnectionIdentifier = userId, Top = top, CallerIdentifier = isAdmin ? AdministratorIdentifier : callerId, Radius = radius.HasValue && radius == 0 ? (int?)null : radius, }; return(proc.CallObjects <T>()); }
public IEnumerable <Profile> Friends(Profile profile, short?top = null) { if (null == profile) { throw new ArgumentNullException("profile"); } if (Guid.Empty == profile.Identifier) { throw new ArgumentException("Identifier"); } var sp = new UserSearchProfile() { CallerIdentifier = profile.Identifier, ConnectionIdentifier = profile.Identifier, Top = top, }; return(sp.CallObjects <Profile>()); }