List <JsPartial> GetPartials(object source, string lang, bool isNestedOnly) { if (!_db.DataReferencesBySource.TryGetValue(source, out var list)) { return(null); } var partials = new List <JsPartial>(); foreach (var dataRef in list) { if (isNestedOnly && !dataRef.IsNested) { continue; } dynamic obj = _partialsByLangTypeById[Tuple.Create(lang, dataRef.Type)][dataRef.Id]; if (IsPartialObjectSkipped(dataRef, obj)) { continue; } var partial = new JsPartial(dataRef.Type, dataRef.Id, obj); partials.Add(partial); } return(partials); }
List <JsPartial> GetPartials(object source, string lang, bool isNestedOnly) { if (!_db.DataReferencesBySource.TryGetValue(source, out var list)) { return(null); } var partials = new List <JsPartial>(); foreach (var dataRef in list) { if (isNestedOnly && !dataRef.IsNested) { continue; } try { dynamic obj = _partialsByLangTypeById[Tuple.Create(lang, dataRef.Type)][dataRef.Id]; if (IsPartialObjectSkipped(dataRef, obj)) { continue; } var partial = new JsPartial(dataRef.Type, dataRef.Id, obj); partials.Add(partial); } catch (KeyNotFoundException ignored) { DatabaseBuilder.PrintLine($"Couldn't find Partial of type '{dataRef.Type}' with ID '{dataRef.Id}'."); } } return(partials); }