/// <summary>
		/// Creates a new instance of a <see cref="SqlClientUploadStreamProvider" /> with the specified configuration settings.
		/// </summary>
        /// <param name="configuration">The <see cref="NameValueConfigurationSection" /> object that holds the configuration settings.</param>
        public OracleBlobUploadStreamProvider(UploadStreamProviderElement configuration)
		{
            string criteriaMethodString = configuration["criteriaMethod"];

            if (criteriaMethodString != null && criteriaMethodString.Length != 0)
                _criteriaMethod = (CriteriaMethod)Enum.Parse(typeof(CriteriaMethod), criteriaMethodString, true);
            else
                _criteriaMethod = CriteriaMethod.SequenceTrigger;

            if (_criteriaMethod == CriteriaMethod.Custom)
            {
                _criteriaGenerator = TypeCache.GetInstance(configuration["criteriaGenerator"], configuration) as ICriteriaGenerator;

                if (_criteriaGenerator == null)
                    throw new ApplicationException("Could not instantiate criteria generator.");
            }

#if NET2
            string connectionStringName = configuration["connectionStringName"];

            if (!string.IsNullOrEmpty(connectionStringName))
                _connectionString = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString;
            else
#endif
                _connectionString = configuration["connectionString"];

            _table = configuration["table"];
            _keyField = configuration["keyField"];
            _dataField = configuration["dataField"];
            _fileNameField = configuration["fileNameField"];
            _sequenceName = configuration["sequenceName"];
		}
Пример #2
0
        /// <summary>
        /// Creates a new instance of the <see cref="S3UploadStreamProvider" /> class with the specified configuration settings.
        /// </summary>
        /// <param name="settings">The <see cref="UploadStreamProviderElement" /> object that holds the configuration settings.</param>
        public S3UploadStreamProvider(UploadStreamProviderElement settings)
            : base(settings)
        {
            string accessKeyId = Settings.Parameters["accessKeyId"];
            string secretAccessKey = Settings.Parameters["secretAccessKey"];
            string bucketName = Settings.Parameters["bucketName"];
            bool useHttps;

            if (string.IsNullOrEmpty(accessKeyId))
                throw new Exception("accessKeyId must be specified for SlickUpload S3 provider");
            if (string.IsNullOrEmpty(secretAccessKey))
                throw new Exception("secretAccessKey must be specified for SlickUpload S3 provider");
            if (string.IsNullOrEmpty(bucketName))
                throw new Exception("bucketName must be specified for SlickUpload S3 provider");

            if (!bool.TryParse(Settings.Parameters["useHttps"], out useHttps))
                useHttps = true;

            _client = new S3BlobClient(accessKeyId, secretAccessKey, bucketName, useHttps);

            _objectNameMethod = TypeFactory.ParseEnum<ObjectNameMethod>(Settings.Parameters["objectNameMethod"], ObjectNameMethod.Client);

            _cacheControl = Settings.Parameters["cacheControl"];
            _contentDisposition = Settings.Parameters["contentDisposition"];
            _contentEncoding = Settings.Parameters["contentEncoding"];
            _cannedAcl = TypeFactory.ParseEnum<S3CannedAcl>(Settings.Parameters["cannedAcl"], S3CannedAcl.Private);
            _storageClass = TypeFactory.ParseEnum<S3StorageClass>(Settings.Parameters["storageClass"], S3StorageClass.Standard);
        }
        /// <summary>
        /// Creates a new instance of the <see cref="FileUploadStreamProvider" /> class with the specified configuration settings.
        /// </summary>
        /// <param name="settings">The <see cref="UploadStreamProviderElement" /> object that holds the configuration settings.</param>
        public FileUploadStreamProvider(UploadStreamProviderElement settings)
            : base(settings)
		{
			_location = Settings.Parameters["location"];

			if (_location == null)
			{
				// TODO: fix up
				throw new Exception("location must be specified for SlickUpload file provider");
			}
			else if (!Path.IsPathRooted(_location))
			{
				_location = HostingEnvironment.MapPath(_location);
			}

			string existingActionString = Settings.Parameters["existingAction"];

			if (!string.IsNullOrEmpty(existingActionString))
				_existingAction = (ExistingAction)Enum.Parse(typeof(ExistingAction), existingActionString, true);
			else
				_existingAction = ExistingAction.Exception;

            string fileNameMethodString = Settings.Parameters["fileNameMethod"];

            if (!string.IsNullOrEmpty(fileNameMethodString))
                _fileNameMethod = (FileNameMethod)Enum.Parse(typeof(FileNameMethod), fileNameMethodString, true);
            else
                _fileNameMethod = FileNameMethod.Client;

            _erroredLocation = Settings.Parameters["erroredLocation"];

            if (!string.IsNullOrEmpty(_erroredLocation) && !Path.IsPathRooted(_erroredLocation))
                _location = HostingEnvironment.MapPath(_erroredLocation);
		}
Пример #4
0
        public ZipUploadStreamProvider(UploadStreamProviderElement settings)
            : base(settings)
		{
            _location = settings.Parameters["location"];

            if (string.IsNullOrEmpty(_location))
                _location = "~/Files/";        
        }
 public MongoDBUploadStreamProvider(UploadStreamProviderElement settings)
     : base(settings)
 {
     storedir = Settings.Parameters["storedir"];
     if (string.IsNullOrWhiteSpace(storedir))
     {
         throw new Exception("StoreDir must be specified for SlickUpload MongoDB provider");
     }
 }
Пример #6
0
        /// <inheritdoc />
        /// <summary>
        /// Overridden. <inherited />
        /// </summary>
        protected override void Reset(ConfigurationElement parentElement)
        {
            UploadStreamProviderElement settings = parentElement as UploadStreamProviderElement;

            if (settings != null)
            {
                settings.UpdatePropertyCollection();
            }

            base.Reset(parentElement);
        }
        /// <summary>
		/// Creates a new instance of the <see cref="SqlClientUploadStreamProvider" /> class with the specified configuration settings.
		/// </summary>
        /// <param name="settings">The <see cref="UploadStreamProviderElement" /> object that holds the configuration settings.</param>
        public SqlClientUploadStreamProvider(UploadStreamProviderElement settings) :
            base(settings)
		{
            string dataTypeString = Settings.Parameters["dataType"];

            if (!string.IsNullOrEmpty(dataTypeString))
                _dataType = (SqlColumnDataType)Enum.Parse(typeof(SqlColumnDataType), dataTypeString, true);
            else
                _dataType = SqlColumnDataType.Image;

            if (_dataType == SqlColumnDataType.FileStream)
                UseInsertTransaction = true;
        }
Пример #8
0
        /// <inheritdoc />
        /// <summary>
        /// Overridden. <inherited />
        /// </summary>
        protected override void Unmerge(ConfigurationElement sourceElement, ConfigurationElement parentElement, ConfigurationSaveMode saveMode)
        {
            UploadStreamProviderElement settings = parentElement as UploadStreamProviderElement;

            if (settings != null)
            {
                settings.UpdatePropertyCollection();
            }

            UploadStreamProviderElement settings2 = sourceElement as UploadStreamProviderElement;

            if (settings2 != null)
            {
                settings2.UpdatePropertyCollection();
            }

            base.Unmerge(sourceElement, parentElement, saveMode);

            UpdatePropertyCollection();
        }
        /// <summary>
        /// Creates a new instance of the <see cref="NullUploadStreamProvider" /> class with the specified configuration settings.
        /// </summary>
        /// <param name="settings">The <see cref="UploadStreamProviderElement" /> object that holds the configuration settings.</param>
        public NullUploadStreamProvider(UploadStreamProviderElement settings)
            : base(settings)
		{ }
        /// <summary>
        /// Creates a new instance of <see cref="DatabaseUploadStreamProviderBase" /> class with the specified settings.
        /// </summary>
        /// <param name="settings">The <see cref="UploadStreamProviderElement" /> object that holds the configuration settings.</param>
        protected DatabaseUploadStreamProviderBase(UploadStreamProviderElement settings)
            : base(settings)
        {
            string connectionStringName = Settings.Parameters["connectionStringName"];

            if (!string.IsNullOrEmpty(connectionStringName))
                _connectionString = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString;
            else
                _connectionString = Settings.Parameters["connectionString"];

            if (string.IsNullOrEmpty(_connectionString))
                throw new Exception("uploadStreamProvider connectionString or connectionStringName attribute must be specified.");
                
            _table = Settings.Parameters["table"];
            _keyField = Settings.Parameters["keyField"];
            _dataField = Settings.Parameters["dataField"];
            _fileNameField = Settings.Parameters["fileNameField"];

            if (string.IsNullOrEmpty(_table))
                throw new Exception("uploadStreamProvider table attribute must be specified.");
            if (string.IsNullOrEmpty(_keyField))
                throw new Exception("uploadStreamProvider keyField attribute must be specified.");
            if (string.IsNullOrEmpty(_dataField))
                throw new Exception("uploadStreamProvider dataField attribute must be specified.");

            // TODO: throw exception for missing parameters

            bool.TryParse(Settings.Parameters["useInsertTransaction"], out _useInsertTransaction);

            string isolationLevelString = Settings.Parameters["useInsertTransaction"];

            if (!string.IsNullOrEmpty(isolationLevelString))
                _isolationLevel = (IsolationLevel)Enum.Parse(typeof(IsolationLevel), isolationLevelString, true);
        }
        public CustomSqlUploadStreamProvider(UploadStreamProviderElement settings)
            : base(settings)
		{ }
        public CustomFileNameUploadStreamProvider(UploadStreamProviderElement settings)
            : base(settings)
		{ }
Пример #13
0
 /// <summary>
 /// Creates a new instance of the <see cref="UploadStreamProviderBase" /> class with the specified settings.
 /// </summary>
 /// <param name="settings">The <see cref="UploadStreamProviderElement" /> object that holds the configuration settings.</param>
 protected UploadStreamProviderBase(UploadStreamProviderElement settings)
 {
     _settings = settings;
 }
		/// <summary>
        /// Creates a new instance of the <see cref="MemoryUploadStreamProvider" /> class with the specified configuration settings.
		/// </summary>
        /// <param name="settings">The <see cref="UploadStreamProviderElement" /> object that holds the configuration settings.</param>
        public MemoryUploadStreamProvider(UploadStreamProviderElement settings)
            : base(settings)
        { }
 public ExceptionUploadStreamProvider(UploadStreamProviderElement config)
     : base(config)
 {
     
 }
		/// <summary>
		/// Creates a new instance of the <see cref="SqlClientUploadStreamProvider" /> class with the specified configuration settings.
		/// </summary>
        /// <param name="settings">The <see cref="SqlFileStreamUploadStreamProvider" /> object that holds the configuration settings.</param>
        public SqlFileStreamUploadStreamProvider(UploadStreamProviderElement settings) :
            base(settings)
		{
            UseInsertTransaction = true;        
        }