public virtual async Task StoreAsync(IdentityServer4.Models.PersistedGrant grant) { var entity = _objectMapper.Map <IdentityServer4.Models.PersistedGrant, PersistedGrant>(grant); var existing = await _persistentGrantRepository.FindByKeyAsync(grant.Key); if (existing == null) { entity.Id = _guidGenerator.Create(); await _persistentGrantRepository.InsertAsync(entity); } else { await _persistentGrantRepository.UpdateAsync(entity); } }
public virtual async Task StoreAsync(IdentityServer4.Models.PersistedGrant grant) { var entity = await _persistentGrantRepository.FindByKeyAsync(grant.Key); if (entity == null) { entity = _objectMapper.Map <IdentityServer4.Models.PersistedGrant, PersistedGrant>(grant); EntityHelper.TrySetId(entity, () => _guidGenerator.Create()); await _persistentGrantRepository.InsertAsync(entity); } else { _objectMapper.Map(grant, entity); await _persistentGrantRepository.UpdateAsync(entity); } }
public async Task <PersistedGrantDto> FindByKeyAsync( string key ) { PersistedGrant item = await PersistentGrantRepository.FindByKeyAsync(key); return(ObjectMapper.Map <PersistedGrant, PersistedGrantDto>(item)); }
public async Task FindByKeyAsync() { (await _persistentGrantRepository.FindByKeyAsync("PersistedGrantKey1")).ShouldNotBeNull(); }