示例#1
0
		/// <summary>
		/// Initializes a new instance.
		/// </summary>
		/// <param name="link">The link this command is associated with.</param>
		protected Command(IDataLink link)
		{
			if (link == null) throw new ArgumentNullException("link", "Link cannot be null.");
			if (link.IsDisposed) throw new ObjectDisposedException(link.ToString());
			_Link = link;

			_Parameters = _Link.Engine.CreateParameterCollection();
			if (_Parameters == null) throw new CannotCreateException(
				"Cannot create a new collection of parameters for this instance.");
		}
		/// <summary>
		/// Initializes a new instance.
		/// </summary>
		/// <param name="link">The link this nestable transaction is associated with.</param>
		/// <param name="mode">The initial transactional mode.</param>
		protected NestableTransaction(
			IDataLink link,
			NestableTransactionMode mode = NestableTransactionMode.Database)
		{
			if (link == null) throw new ArgumentNullException("link", "Link cannot be null.");
			if (link.IsDisposed) throw new ObjectDisposedException(link.ToString());

			_Link = link;
			_Mode = mode;
		}
        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        /// <param name="link">The link this nestable transaction is associated with.</param>
        /// <param name="mode">The initial transactional mode.</param>
        protected NestableTransaction(
            IDataLink link,
            NestableTransactionMode mode = NestableTransactionMode.Database)
        {
            if (link == null)
            {
                throw new ArgumentNullException("link", "Link cannot be null.");
            }
            if (link.IsDisposed)
            {
                throw new ObjectDisposedException(link.ToString());
            }

            _Link = link;
            _Mode = mode;
        }
示例#4
0
        /// <summary>
        /// Returns a new instance that will be associated with the new given link and that will
        /// contain a copy of the maps and customizations of the original one.
        /// </summary>
        /// <returns>A new instance.</returns>
        public DataRepository Clone(IDataLink link)
        {
            if (IsDisposed)
            {
                throw new ObjectDisposedException(this.ToString());
            }
            if (link == null)
            {
                throw new ArgumentNullException("link", "Link cannot be null.");
            }
            if (link.IsDisposed)
            {
                throw new ObjectDisposedException(link.ToString());
            }

            var cloned = new DataRepository(link); OnClone(cloned);

            return(cloned);
        }
示例#5
0
        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        /// <param name="link">The link this command is associated with.</param>
        protected Command(IDataLink link)
        {
            if (link == null)
            {
                throw new ArgumentNullException("link", "Link cannot be null.");
            }
            if (link.IsDisposed)
            {
                throw new ObjectDisposedException(link.ToString());
            }
            _Link = link;

            _Parameters = _Link.Engine.CreateParameterCollection();
            if (_Parameters == null)
            {
                throw new CannotCreateException(
                          "Cannot create a new collection of parameters for this instance.");
            }
        }
示例#6
0
        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        /// <param name="link">The link this repository will be associated with.</param>
        public DataRepository(IDataLink link)
        {
            if (link == null)
            {
                throw new ArgumentNullException("link", "Data Link cannot be null.");
            }
            if (link.IsDisposed)
            {
                throw new ObjectDisposedException(link.ToString());
            }

            _Link         = link;
            _TemplateLink = link.Clone();

            _SerialId       = ++Uber.RepositoryLastSerial;
            _UberMaps       = new UberMapCollection(this);
            _UberOperations = new UberOperationList(this);

            if (Uber.EnableCollector)
            {
                EnableCollector();
            }
        }