コード例 #1
0
ファイル: BackupDataService.cs プロジェクト: itfenom/BackBock
        /// <summary>
        /// Gets the backup data for a given repository type.
        /// </summary>
        /// <param name="repotype">The repository type.</param>
        /// <param name="user">The requesting user with permissions.</param>
        /// <param name="parameters">Optional specified parameters. Can be <c>null</c>.</param>
        /// <returns>
        /// A set of Backup data.
        /// </returns>
        /// <exception cref="ArgumentNullException"><paramref name="user" /> is <c>null</c>.</exception>
        public BackupData GetBackupData(BackupRepositoryType repotype, IPrincipal user, StringDictionary parameters)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            var repo          = this.repositories.First(x => x.RepositoryType == repotype);
            var dto           = repo.GetBackupData();
            var mapper        = new BackupDataAssembler();
            var bussinessData = mapper.ConvertFromDTO(dto);

            return(bussinessData);

            /*if (this.repository is BackupDataFsRepository)
             * {
             *  var repo = (BackupDataFsRepository)this.repository;
             *  return repo.LoadBackupData(parameters["filename"], parameters);
             * }
             * else if (this.repository is BackupDataRepository)
             * {
             *  return this.repository.GetBackupData();
             * }*/

            // throw new NotSupportedException("Unknown Repository Type");

            // return this.repository.GetFeaturedProducts();
            // return from p in
            // this.repository.GetFeaturedProducts()
            // select p.ApplyDiscountFor(user);
        }
コード例 #2
0
ファイル: BackupDataService.cs プロジェクト: Jedzia/BackBock
        /// <summary>
        /// Gets the backup data for a given repository type.
        /// </summary>
        /// <param name="repotype">The repository type.</param>
        /// <param name="user">The requesting user with permissions.</param>
        /// <param name="parameters">Optional specified parameters. Can be <c>null</c>.</param>
        /// <returns>
        /// A set of Backup data.
        /// </returns>
        /// <exception cref="ArgumentNullException"><paramref name="user" /> is <c>null</c>.</exception>
        public BackupData GetBackupData(BackupRepositoryType repotype, IPrincipal user, StringDictionary parameters)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            var repo = this.repositories.First(x => x.RepositoryType == repotype);
            var dto = repo.GetBackupData();
            var mapper = new BackupDataAssembler();
            var bussinessData = mapper.ConvertFromDTO(dto);
            return bussinessData;

            /*if (this.repository is BackupDataFsRepository)
            {
                var repo = (BackupDataFsRepository)this.repository;
                return repo.LoadBackupData(parameters["filename"], parameters);
            }
            else if (this.repository is BackupDataRepository)
            {
                return this.repository.GetBackupData();
            }*/

            // throw new NotSupportedException("Unknown Repository Type");

            // return this.repository.GetFeaturedProducts();
            // return from p in
            // this.repository.GetFeaturedProducts()
            // select p.ApplyDiscountFor(user);
        }