public HomeCollectionController(IFileIO fileIO)
 {   // used when loading a collection with the controller
     if (fileIO == null)
     {
         throw new FileIOException("Injected file IO must not be null");
     }
     _fileIO         = fileIO;
     _homeCollection = null;
     _repo           = null;
 }
 public HomeCollectionController(ICollectionBase homeCollection, IFileIO fileIO)
 {
     if (homeCollection == null)
     {
         throw new CollectionException("Collection controller must be initialized with a collection base object");
     }
     _homeCollection = homeCollection;
     if (fileIO == null)
     {
         throw new FileIOException("Injected file IO must not be null");
     }
     _fileIO = fileIO;
     _repo   = null;
 }
        // add ImportCollection - adds content to an existing collection of same type

        /****************************************** helper methods **********************************************************/
        internal IHomeCollectionRepository Repository()
        {
            try
            {
                if (_repo == null)
                {
                    if (_homeCollection == null)
                    {
                        _repo = new HomeCollectionRepository(_fileIO);
                    }
                    else
                    {
                        _repo = new HomeCollectionRepository(_homeCollection, _fileIO);
                    }
                }
                return(_repo);
            }
            catch (Exception ex)
            {
                throw new CollectionException("Unable to initialize Repository", ex);
            }
        }
Esempio n. 4
0
 public HomeCollectionService(IHomeCollectionRepository homeCollectionRepository, IMapper mapper)
 {
     _homeCollectionRepository = homeCollectionRepository;
     _mapper = mapper;
 }