??????????????У???????????????????洢????????洢?????????????в??????仯????????????????????仯?????????????????????????
?????????????洢?????????????
????Presentation??-WebAPI??CNBlogsRefreshTokenProvider
????Application??-?????IRefreshTokenService
????Application??-????RefreshTokenService
????Domain??-??壺RefreshToken
????Repository??-????IRefreshTokenRepository
????Repository??-????FileStorage.RefreshTokenRepository
????????????????????
????Presentation???CNBlogsRefreshTokenProvider -> Application?????IRefreshTokenService + Domain??????RefreshToken??
????Application??????RefreshTokenService -> Repository?????IRefreshTokenRepository + Domain??????RefreshToken??
????Repository??????FileStorage.RefreshTokenRepository -> Domain??????RefreshToken??
???????????????????????????洢????????洢?????????????——???????????洢??????????ORM?????????EF???????IRefreshTokenRepository?????????????????????????1?д???
????????????????????дIRefreshTokenRepository???????Database.RefreshTokenRepository????????????????Щ???????
??????????????洢??FireStorage.RefreshTokenRepository????????????????????????????????????????????
public class RefreshTokenRepository : IRefreshTokenRepository
{
private List<RefreshToken> _refreshTokens;
public RefreshTokenRepository()
{
//...
}
public async Task<RefreshToken> FindById(string Id)
{
return _refreshTokens.Where(x => x.Id == Id).FirstOrDefault();
}
}
???????????Entity FrameworkдDatabase.RrefreshTokenRepository?????????????д?????LINQ???????????????е?????????
public class RefreshTokenRepository : IRefreshTokenRepository
{
public RefreshTokenRepository()
{
}
public async Task<RefreshToken> FindById(string Id)
{
using (var context = new OpenApiDbContext())
{
return context.Set<RefreshToken>()
.Where(x => x.Id == Id).FirstOrDefault();
}
}
}