예제 #1
0
        public async Task <IEnumerable <T> > LoadModelsFromSnapshotFile <T>(string fileName) where T : class, IObjectBase
        {
            var snapshotType = _snapshotMapper.SnapshotTypeFor <T>();
            var snapshots    = await loadSnapshot(fileName, snapshotType);

            return(await loadModelsFromSnapshots <T>(snapshots));
        }
예제 #2
0
        public async Task <IEnumerable <T> > LoadModelFromSnapshot <T>(string fileName) where T : class, IObjectBase
        {
            var snapshotType = _snapshotMapper.SnapshotTypeFor <T>();
            var snapshots    = await loadSnapshot(fileName, snapshotType);

            if (snapshots == null)
            {
                return(Enumerable.Empty <T>());
            }

            var tasks  = snapshots.Select(_snapshotMapper.MapToModel);
            var models = await Task.WhenAll(tasks);

            return(models.OfType <T>());
        }