예제 #1
0
 public T Find <T>(object id) where T : class
 {
     return(EntityEntries
            .Select(x => x.Instance)
            .OfType <T>()
            .FirstOrDefault(x => HasEntityId(x, id)));
 }
예제 #2
0
 public IEnumerable <IDbEntityEntry> Entries()
 {
     return(EntityEntries.Select(x => new InMemoryDbEntityEntry(x)));
 }
예제 #3
0
 public Task <T> FirstOrDefaultAsync <T>(Expression <Func <T, bool> > predicate, CancellationToken cancellationToken = default(CancellationToken)) where T : class
 {
     return(Task.FromResult(EntityEntries.Select(x => x.Instance).OfType <T>().FirstOrDefault(predicate.Compile())));
 }
예제 #4
0
 public T First <T>(Expression <Func <T, bool> > predicate) where T : class
 {
     return(EntityEntries.Select(x => x.Instance).OfType <T>().First(predicate.Compile()));
 }
예제 #5
0
 public Task <T> GetAsync <T>(object id) where T : class
 {
     return(Task.FromResult(EntityEntries.Select(x => x.Instance).OfType <T>().First(x => HasEntityId(x, id))));
 }
예제 #6
0
 public IEnumerable <T> FindAllWithAdded <T>() where T : class
 {
     return(EntityEntries
            .Select(x => x.Instance)
            .OfType <T>());
 }