Example #1
0
        public Task ExecuteSync(Action <T, object> action, object state, ContainerElementReference <T> reference = null)
        {
            if (reference != null)
            {
                if (!reference.ContainerId.Equals(this.GetPrimaryKey()))
                {
                    throw new InvalidOperationException();
                }
                var curItem = GetItemAt(reference.Offset);
                action(curItem, state);
            }
            else
            {
                foreach (var item in Collection)
                {
                    action(item, state);
                }
            }

            return(TaskDone.Done);
        }
Example #2
0
        public async Task <object> ExecuteSync(Func <T, object> func, ContainerElementReference <T> reference)
        {
            var container = _containers.First(c => c.GetPrimaryKey().Equals(reference.ContainerId));

            return(await container.ExecuteSync(func, reference));
        }
Example #3
0
 public Task ExecuteAsync(Func <T, Task> func, ContainerElementReference <T> reference = null)
 {
     return(ExecuteAsync((x, state) => func(x), null, reference));
 }
Example #4
0
 public virtual Task <bool> Remove(ContainerElementReference <T> reference)
 {
     return(Elements.Remove(reference));
 }
Example #5
0
 public Task <object> ExecuteSync(Func <T, object> func, ContainerElementReference <T> reference = null)
 {
     return(ExecuteSync((x, state) => func(x), null, reference));
 }
Example #6
0
        public async Task <object> ExecuteSync(Func <T, object, object> func, object state, ContainerElementReference <T> reference)
        {
            if (!this.GetPrimaryKey().Equals(reference.ContainerId))
            {
                throw new InvalidOperationException();
            }
            var curItem = Elements.GetElement(reference);
            var result  = func(curItem, state);

            return(result);
        }
Example #7
0
 public Task ExecuteSync(Action <T> action, ContainerElementReference <T> reference = null)
 {
     return(ExecuteSync((x, state) => action(x), null, reference));
 }
Example #8
0
        public async Task <object> ExecuteAsync(Func <T, object, Task <object> > func, object state, ContainerElementReference <T> reference)
        {
            var curItem = Elements.GetElement(reference);
            var result  = await func(curItem, state);

            return(result);
        }
Example #9
0
 protected bool Equals(ContainerElementReference <T> other)
 {
     return(base.Equals(other));
 }
Example #10
0
 public ContainerElement(ContainerElementReference <T> reference, T item)
 {
     Reference = reference;
     Item      = item;
 }