Ejemplo n.º 1
0
        public void Delete(IEnumerable<Entity> entities)
        {
            if (entities == null)
                throw new ArgumentNullException("entities");

            if (entities.Count() == 0)
                return;

            var batch = new GlobalBatch(cache, database);
            try
            {
                batch.Start();

                foreach (var entity in entities)
                {
                    if (entity is Artist)
                        batch.DeleteArtist(entity as Artist);
                    else if (entity is Work)
                        batch.DeleteWork(entity as Work);
                }

                batch.Stop();
            }
            finally
            {
                batch.Close();
            }
        }
Ejemplo n.º 2
0
        public void Delete(IEnumerable <Entity> entities)
        {
            if (entities == null)
            {
                throw new ArgumentNullException("entities");
            }

            if (entities.Count() == 0)
            {
                return;
            }

            var batch = new GlobalBatch(cache, database);

            try
            {
                batch.Start();

                foreach (var entity in entities)
                {
                    if (entity is Artist)
                    {
                        batch.DeleteArtist(entity as Artist);
                    }
                    else if (entity is Work)
                    {
                        batch.DeleteWork(entity as Work);
                    }
                }

                batch.Stop();
            }
            finally
            {
                batch.Close();
            }
        }