public virtual async Task DeleteAsync <T>(T entity, IDeleteCommandInterceptor deleteStrategy) where T : class
        {
            Check.NotNull(entity, "entity");
            Check.NotNull(deleteStrategy, "deleteStrategy");

            await Task.Run(() => Delete(entity, deleteStrategy));
        }
        public CommandInterceptors(IDeleteCommandInterceptor deleteCommandInterceptor)
            : this()
        {
            Check.NotNull(deleteCommandInterceptor, "deleteCommandInterceptor");

            DeleteCommandInterceptor = deleteCommandInterceptor;
        }
Example #3
0
        public virtual void Delete <T>(T entity, IDeleteCommandInterceptor deleteStrategy) where T : class
        {
            Check.NotNull(entity, "entity");
            Check.NotNull(deleteStrategy, "deleteStrategy");

            deleteStrategy.Delete(this, Delete, entity);
        }
Example #4
0
        public CommandInterceptors(IDeleteCommandInterceptor deleteCommandInterceptor)
            : this()
        {
            Check.NotNull(deleteCommandInterceptor, "deleteCommandInterceptor");

            DeleteCommandInterceptor = deleteCommandInterceptor;
        }
        protected override void DeleteEntityActioned <T>(T entity, IDeleteCommandInterceptor deleteCommandInterceptor)
        {
            deleteCommandInterceptor.Delete(
                this,
                new Action <T>(p =>
            {
                var bsonValue  = MongoDbOverridables.Instance.GetBsonIdValueFromEntity(entity);
                var mongoQuery = Query.EQ("_id", bsonValue);

                var collectionName = CollectionHelpers.CollectionNameFromEntity(entity);
                var result         = MongoDatabase.GetCollection <T>(collectionName).Remove(mongoQuery, RemoveFlags.Single);
                RaiseEvent(new MongoDbEntityDeletedEvent(this, entity, result));
            }),
                entity);
        }
        public DefaultRepositoryInterceptors(IDeleteCommandInterceptor deleteCommandInterceptor)
        {
            Check.NotNull(deleteCommandInterceptor, "deleteCommandInterceptor");

            DeleteCommandInterceptor = deleteCommandInterceptor;
        }
        public DefaultRepositoryInterceptors(IDeleteCommandInterceptor deleteCommandInterceptor)
        {
            Check.NotNull(deleteCommandInterceptor, "deleteCommandInterceptor");

            DeleteCommandInterceptor = deleteCommandInterceptor;
        }