Esempio n. 1
0
        public Task <bool> Add(Disposer disposer, string collectionName = "")
        {
            TaskCompletionSource <bool> tcs = new TaskCompletionSource <bool>();

            this.AddToCache(disposer, collectionName);

            if (collectionName == "")
            {
                collectionName = disposer.GetType().Name;
            }
            DBSaveTask task = EntityFactory.CreateWithId <DBSaveTask, Disposer, string, TaskCompletionSource <bool> >(disposer.Id, disposer, collectionName, tcs);

            this.tasks[(int)((ulong)task.Id % taskCount)].Add(task);

            return(tcs.Task);
        }
Esempio n. 2
0
        public Task <bool> Add(Entity entity, string collectionName = "")
        {
            TaskCompletionSource <bool> tcs = new TaskCompletionSource <bool>();

            this.AddToCache(entity, collectionName);

            if (collectionName == "")
            {
                collectionName = entity.GetType().Name;
            }
            DBSaveTask task = new DBSaveTask(entity, collectionName, tcs);

            this.tasks[(int)((ulong)task.Id % taskCount)].Add(task);

            return(tcs.Task);
        }
Esempio n. 3
0
 public override void Awake(DBSaveTask self, Component entity, string collectionName, TaskCompletionSource <bool> tcs)
 {
     self.Disposer       = entity;
     self.CollectionName = collectionName;
     self.Tcs            = tcs;
 }