public async Task <IEnumerable <T> > GetAsync <T>(IDbConnection dbConnection) where T : class, TRepositoryModel { _logger.LogInformation($"Getting all {typeof(T)}..."); var dalObject = await _dbContext.GetAllAsync(dbConnection); return(_objectDocumentSerializer.Deserialize <TDataModel, T>(dalObject)); }
public async Task <IEnumerable <T> > GetAsync <T>() where T : class, TRepositoryModel { _logger.LogInformation($"Getting all {typeof(T)}..."); return(await _memoryCache.GetOrCreateAsync(CreateCacheKey <TRepositoryModel>(All), async entry => { entry.SlidingExpiration = TimeSpan.FromHours(8); using (var dbConnection = await _dbConnectionFactory.OpenConnectionAsync()) { var dalObject = await _dbContext.GetAllAsync(dbConnection); return _objectDocumentSerializer.Deserialize <TDataModel, T>(dalObject); } })); }
public void Deserialize_AsTestModel() { _logger.LogInformation("Deserialize_AsTestModel"); var item = GF.New <DalModels.Account>(); item.ObjectDocument = @" { ""Property00"": ""cleanse"", ""Property10"": 97, ""Property20"": 27.27, ""Property30"": ""2005-08-21T05:25:58"" } "; var result = _objectDocumentSerializer.Deserialize <DalModels.Account, TestAccount>(item); Assert.NotNull(result); Assert.Equal("cleanse", result.Property00); Assert.Equal(97, result.Property10); Assert.Equal(27.27m, result.Property20); Assert.Equal(DateTime.Parse("2005-08-21T05:25:58"), result.Property30); }