public async Task <ResultResponseDto> StoreAsync(PersistedGrantDto dto) { if (!dto.IsValid(Logger, LogLevel.Error)) { return(Result.ReFailure <ResultResponseDto>("请求参数错误", ResultCodes.InvalidParameter)); } //转换为存储对象 PersistedGrant grant = null; if (base.State == null) { //添加令牌 grant = Mapper.Map <PersistedGrant>(dto); grant.SetId(this.GetPrimaryKeyString()); } else { grant = base.State.Clone <PersistedGrant>(); grant = Mapper.Map(dto, grant); } if (!grant.IsValid(Logger, LogLevel.Error)) { return(Result.ReFailure <ResultResponseDto>("请求参数错误", ResultCodes.InvalidParameter)); } base.State = grant; await base.WriteStateAsync(); return(Result.ReSuccess <ResultResponseDto>()); }