public static ETTask <T> Upsert <T>(this DBComponent db, string collectionName, T entity) where T : ComponentWithId { ETTaskCompletionSource <T> tcs = new ETTaskCompletionSource <T>(); DBUpsertTask <T> task = ComponentFactory.Create <DBUpsertTask <T>, string, T, ETTaskCompletionSource <T> > (collectionName, entity, tcs); db.tasks[(int)((ulong)task.Id % DBComponent.taskCount)].Add(task); return(tcs.Task); }
public override void Awake(DBUpsertTask <ComponentWithId> self, string collectionName, ComponentWithId entity, ETTaskCompletionSource <ComponentWithId> tcs) { self.CollectionName = collectionName; self.Tcs = tcs; self.entity = entity; }