/// <summary> /// Fetches ds data using ds.get /// FetchDSCompleted event will not be fired. /// </summary> /// <param name="uid">The user Id.</param> /// <param name="settings">The mapping settings.</param> /// <returns></returns> public ExpandoObject GetAll(string uid) { if (_dsSettings == null) { return(null); } var model = new Dictionary <string, object>(); foreach (var mappingType in _dsSettings.MappingsByType) { var dsType = mappingType.Key; foreach (var mapping in mappingType.Value.GroupBy(i => i.Custom.Oid)) { var fields = mapping.Select(i => i.GigyaFieldName).Distinct(); var data = Get(uid, mapping.Key, dsType, fields); if (data != null) { Dictionary <string, object> mappedDsResult = MapDataToDsType(mappingType.Key, data); model = DynamicUtils.MergeToDictionary(model, mappedDsResult); } } } if (!model.Any()) { return(null); } return(model.ToExpando()); }
/// <summary> /// Fetches all ds data using ds.search. /// FetchDSCompleted event will not be fired. /// </summary> /// <param name="uid">The user Id.</param> public ExpandoObject SearchAll(string uid) { if (_dsSettings == null) { return(null); } var model = new Dictionary <string, object>(); foreach (var mappingType in _dsSettings.MappingsByType) { var fields = mappingType.Value.Select(i => i.GigyaFieldName).Distinct(); var data = Search(uid, mappingType.Key, fields); if (data != null) { // do some merge of the data Dictionary <string, object> mappedDsResult = MapDataToDsType(mappingType.Key, data); model = DynamicUtils.MergeToDictionary(model, mappedDsResult); } } if (!model.Any()) { return(null); } return(model.ToExpando()); }