diff --git a/src/Umbraco.Core/Services/IMediaService.cs b/src/Umbraco.Core/Services/IMediaService.cs index c8b9db6967..63248b3974 100644 --- a/src/Umbraco.Core/Services/IMediaService.cs +++ b/src/Umbraco.Core/Services/IMediaService.cs @@ -9,6 +9,8 @@ namespace Umbraco.Core.Services /// public interface IMediaService : IService { + IEnumerable GetByIds(IEnumerable ids); + /// /// Creates an object using the alias of the /// that this Media should based on. @@ -193,7 +195,7 @@ namespace Umbraco.Core.Services /// /// Path of the media item to retreive (for example: /media/1024/koala_403x328.jpg) /// - IMedia GetMediaByPath(string mediaPath); + IMedia GetMediaByPath(string mediaPath); /// /// Gets a collection of objects, which are ancestors of the current media. diff --git a/src/Umbraco.Core/Services/MediaService.cs b/src/Umbraco.Core/Services/MediaService.cs index 8d85007a16..0e7d9dafd8 100644 --- a/src/Umbraco.Core/Services/MediaService.cs +++ b/src/Umbraco.Core/Services/MediaService.cs @@ -206,6 +206,19 @@ namespace Umbraco.Core.Services } } + /// + /// Gets an object by Id + /// + /// Ids of the Media to retrieve + /// + public IEnumerable GetByIds(IEnumerable ids) + { + using (var repository = _repositoryFactory.CreateMediaRepository(_uowProvider.GetUnitOfWork())) + { + return repository.GetAll(ids.ToArray()); + } + } + /// /// Gets an object by its 'UniqueId' ///