Beispiel #1
0
 public virtual Task UpdateAsync(TInterface model, CancellationToken cancellationToken = default(CancellationToken))
 {
     if (string.IsNullOrEmpty(model.Id))
     {
         model.Id = InMemoryObjectId.GenerateNewId().ToString();
     }
     Store[model.Id] = (TImplementation)model;
     return(Task.CompletedTask);
 }
Beispiel #2
0
 public virtual Task <IEnumerable <TInterface> > CreateManyAsync(IEnumerable <TInterface> models, CancellationToken cancellationToken = default(CancellationToken))
 {
     foreach (var model in models)
     {
         if (string.IsNullOrEmpty(model.Id))
         {
             model.Id = InMemoryObjectId.GenerateNewId().ToString();
         }
         Store[model.Id] = (TImplementation)model;
     }
     return(Task.FromResult(models));
 }