Exemple #1
0
        public TEntity[] GetEntities <TEntity>(string source, string environment) where TEntity : class
        {
            _logger.LogInformation("Get entities data from {source}, {environment}", source, environment);
            var json = JsonLoader.GetByName(source, environment, _sourcesPrefix, _sourcesAssembly);

            var items = ImportFromJson.DeserializeCollectionOf <TEntity>(json);

            _logger.LogInformation("Found {count} item(s)", items.Length);
            return(items);
        }
        public TEntity[] GetEntities <TEntity>(string source, string environment) where TEntity : class
        {
            try
            {
                _logger.LogInformation(
                    "Get entities data from path: {path}, assembly: {assembly}.",
                    $"{_sourcesPrefix}.{environment}.{source}",
                    _sourcesAssembly.GetName());
                var json = JsonLoader.GetByName(source, environment, _sourcesPrefix, _sourcesAssembly);

                _logger.LogInformation("Retrieved json: {json}", json);

                var items = ImportFromJson.DeserializeCollectionOf <TEntity>(json);

                _logger.LogInformation("Found {count} item(s)", items.Length);
                return(items);
            }
            catch (Exception e)
            {
                _logger.LogCritical(e, "Couldn't retrieve entities.");
                throw;
            }
        }