예제 #1
0
        /// <summary>
        /// Creates a new <see cref="CargoFileDataSource"/>, using the given filename for a file.
        /// </summary>
        /// <param name="filename">The file to use.</param>
        /// <remarks>
        /// If the filename is not rooted (i.e. is a relative path), and this class is being instantiated
        /// in an appdomain in which a System.Web based web application is running, the file will be created
        /// relative to the App_Data folder.
        /// </remarks>
        public CargoFileDataSource(string filename)
        {
            FigureOutIfInWebApplication();

            if (!Path.IsPathRooted(filename))
            {
                if (_inWebApplication && !string.IsNullOrEmpty(_appDataPath))
                {
                    filename = Path.Combine(_appDataPath, filename);
                }
            }

            _fds = new FileDataSource(filename);
        }
예제 #2
0
        /// <inheritdoc />
        protected override void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    if (_fds != null)
                    {
                        _fds.Dispose();
                        _fds = null;
                    }
                }

                _disposed = true;
            }

            base.Dispose(disposing);
        }