Exemple #1
0
        protected override void InMemoryLogic(EntityCollectionBase target)
        {
            OGM?foreignItem = target.ForeignItem(this);

            if (foreignItem is null)
            {
                target.ForEach((index, item) =>
                {
                    if (item is not null)
                    {
                        target.RemoveAt(index);
                    }
                });
            }
            else
            {
                int[] indexes = target.IndexOf(foreignItem);
                foreach (int index in indexes)
                {
                    CollectionItem?item = target.GetItem(index);
                    if (item is not null)
                    {
                        target.RemoveAt(index);
                    }
                }
            }
        }
Exemple #2
0
        protected override void InMemoryLogic(EntityCollectionBase target)
        {
            OGM?foreignItem = target.ForeignItem(this);

            if (foreignItem is null)
            {
                target.ForEach((index, item) =>
                {
                    if (item is not null)
                    {
                        if (item.IsAfter(Moment))
                        {
                            target.RemoveAt(index);
                        }
                        else if (item.Overlaps(Moment))
                        {
                            target.SetItem(index, target.NewCollectionItem(target.Parent, item.Item, item.StartDate, Moment));
                        }
                    }
                });
            }
            else
            {
                int[] indexes = target.IndexOf(foreignItem);
                foreach (int index in indexes)
                {
                    CollectionItem?item = target.GetItem(index);
                    if (item is not null)
                    {
                        if (item.IsAfter(Moment))
                        {
                            target.RemoveAt(index);
                        }
                        else if (item.Overlaps(Moment))
                        {
                            target.SetItem(index, target.NewCollectionItem(target.Parent, item.Item, item.StartDate, Moment));
                        }
                    }
                }
            }
        }