コード例 #1
0
        /// <summary>
        ///     Initialize
        /// </summary>
        /// <param name="scopeToWrap">
        ///     Accepts null
        /// </param>
        /// <param name="repository">
        ///     Must not be null.
        /// </param>
        private void Initialize(IStorageTransactionScope scopeToWrap, IRepository repository)
        {
            _wrappedScope = scopeToWrap;
            Repository    = repository;

            NoTransaction = !repository.ObjectFactory.FileSystemProvider.IsStorageAmbientTransactionActive;
            // must be last statement executed in a constructor
            if (IncrementNestLevel() == 1)
            {
                Check.Require(TopLevelScope == null, "TopLevelScope out of sync with nest level");
                TopLevelScope = this;
            }

            Check.Ensure((NoTransaction && IsNullScope) || (!NoTransaction && !IsNullScope));
        }
コード例 #2
0
 /// <summary>
 ///		Create scope by wrapping specified scope
 /// </summary>
 /// <param name="repository">
 ///		Repository
 /// </param>
 /// <param name="scopeToWrap">
 ///		Accepts <see langword="null"/> to create NULL scope, <see cref="IsNullScope"/>
 /// </param>
 protected StorageTransactionScope(IRepository repository, IStorageTransactionScope scopeToWrap)
 {
     Initialize(scopeToWrap, repository);
 }