public Lite <T> GetLite(PrimaryKey id, IRetriever retriever) { Interlocked.Increment(ref hits); var lite = (LiteImp <T>)Lite.Create <T>(id, toStrings.Value[id]); return(retriever.ModifiablePostRetrieving(lite) !); }
public async Task FillAsync(Dictionary <LookupToken, IEnumerable> lookups, IRetriever retriever, CancellationToken token) { Dictionary <K, MList <V> > requests = (Dictionary <K, MList <V> >)lookups.TryGetC(Token); if (requests == null) { return; } using (HeavyProfiler.Log("SQL", () => Command.Sql)) using (DbDataReader reader = await Executor.UnsafeExecuteDataReaderAsync(Command, token: token)) { ProjectionRowEnumerator <KeyValuePair <K, MList <V> .RowIdElement> > enumerator = new ProjectionRowEnumerator <KeyValuePair <K, MList <V> .RowIdElement> >(reader, ProjectorExpression, lookups, retriever, token); IEnumerable <KeyValuePair <K, MList <V> .RowIdElement> > enumerabe = new ProjectionRowEnumerable <KeyValuePair <K, MList <V> .RowIdElement> >(enumerator); try { var lookUp = enumerabe.ToLookup(a => a.Key, a => a.Value); foreach (var kvp in requests) { var results = lookUp[kvp.Key]; ((IMListPrivate <V>)kvp.Value).InnerList.AddRange(results); ((IMListPrivate <V>)kvp.Value).InnerListModified(results.Select(a => a.Element).ToList(), null); retriever.ModifiablePostRetrieving(kvp.Value); } } catch (Exception ex) when(!(ex is OperationCanceledException)) { FieldReaderException fieldEx = enumerator.Reader.CreateFieldReaderException(ex); fieldEx.Command = Command; fieldEx.Row = enumerator.Row; fieldEx.Projector = ProjectorExpression; throw fieldEx; } } }
public T ModifiablePostRetrieving <T>(T entity) where T : Modifiable { return(Parent.ModifiablePostRetrieving(entity)); }