public GoodsInformation <string> CreateGoodsInformation(GrpcCacheGoodsInformation cacheGoodsInformation) { var goodsInformation = new GoodsInformation <string>() { Count = cacheGoodsInformation.GoodsInformation.Count, }; if (cacheGoodsInformation.GoodsInformation.GoodCells != null) { var goodCells = new List <GoodCellModel>(); goodCells.AddRange(cacheGoodsInformation.GoodsInformation.GoodCells.Select(ggc => GetGoodCellModel(ggc))); goodsInformation.GoodCells = goodCells; } if (cacheGoodsInformation.GoodsInformation.Questions != null) { var questions = new List <QuestionsBase <string> >(); questions.AddRange(cacheGoodsInformation.GoodsInformation.Questions.Select(gq => GetQuestions(gq))); goodsInformation.Questions = questions; } return(goodsInformation); }
public GrpcCacheGoodsInformation CreateGrpcCacheGoodsInformation(string key, GoodsInformation <string> goodsInformation) { var cacheGoodsInformation = new GrpcCacheGoodsInformation() { Key = new Key() { Key_ = key }, GoodsInformation = new GrpcGoodsInformation() { Count = goodsInformation.Count, } }; if (goodsInformation.GoodCells != null) { cacheGoodsInformation.GoodsInformation.GoodCells.AddRange(goodsInformation.GoodCells.Select(gc => GetGrpcGoodCellModel(gc))); } if (goodsInformation.Questions != null) { cacheGoodsInformation.GoodsInformation.Questions.AddRange(goodsInformation.Questions.Select(q => GetGrpcQuestions(q))); } return(cacheGoodsInformation); }
public static async Task AddGoodsInformationAsync(this IDistributedCache cache, Key key, GrpcCacheGoodsInformation goodsInformation) { var options = GetDistributedCacheEntryOptions(); await cache.SetAsync(key.Key_, goodsInformation, options); }
public override async Task <Empty> AddGoodsInformation(GrpcCacheGoodsInformation goodsInformation, ServerCallContext context) { await _cache.AddGoodsInformationAsync(goodsInformation.Key, goodsInformation); return(new Empty()); }