I am Using ASPNETZero in my Application Where the Entities are Soft Deleted with the help of the below Code Snippet.
var query = Repository.GetAll()
            .Where("Id == @0", input.Id)
            .ProjectTo<TDto>(ItemMapper);
        var dto = await AsyncExecuter.SingleAsync(query, true);
        await base.DeleteAsync(input);
        await CurrentUnitOfWork.SaveChangesAsync();
        await EventBus.TriggerAsync(new DestroyEvent<TDto>(dto));
It sets the IsDeleted Property to False but I want to check Whether the Value Exist in the Reference Table, If Exist then don't Delete (Soft Delete) the Entity
                        
If you created Entites with code-first like this:
You can write a query to get Book which not is referenced in BookPage: