public override async Task <bool> OnShouldExecuteAsync(IContext context) { bool returnValue = false; // // Get a repository for IEmployeeEntity. // IQueryableRepository <IEmployeeEntity> repository = await this.RepositoryFactory.GetQueryableAsync <IEmployeeEntity>(); // // Get the context. This can be disposed because it is defined as transient // in the container. // using (IRepositoryContext db = await repository.GetContextAsync()) { returnValue = await db.CanConnectAsync(); } // // Since we are using transient lifetimes, we need to dispose. // await repository.TryDisposeAsync(); return(returnValue); }