public async Task <PersistedGrant> GetAsync(string key) { ArgumentValidation.ValidateString(nameof(key), key); var session = await _repository.StartSessionAsync(); session.StartTransaction(); var result = await _persistentGrantCollection.FindSingleOrDefaultAsync(session, x => x.Key == key); await session.CommitTransactionAsync(); return(result); }
public async Task <Client> FindClientByIdAsync(string clientId) { ArgumentValidation.ValidateString(nameof(clientId), clientId); var session = await _repository.StartSessionAsync(); session.StartTransaction(); var result = await _clientCollection.FindSingleOrDefaultAsync(session, x => x.ClientId == clientId); await session.CommitTransactionAsync(); return(result); }
public async Task <OspPermission> GetPermissionById(string permissionId) { ArgumentValidation.ValidateString(nameof(permissionId), permissionId); var session = await _repository.StartSessionAsync(); session.StartTransaction(); var result = await _permissionCollection.FindSingleOrDefaultAsync(session, x => x.PermissionId == permissionId); await session.CommitTransactionAsync(); return(result); }
public async Task <OspApiResource> GetApiResourceByNameAsync(string apiResourceName) { ArgumentValidation.ValidateString(nameof(apiResourceName), apiResourceName); using (var session = await _repository.StartSessionAsync()) { session.StartTransaction(); var result = await _apiResourceCollection.FindSingleOrDefaultAsync(session, x => x.Name == apiResourceName); await session.CommitTransactionAsync(); return(result); } }