コード例 #1
0
		public void AlwaysTrue()
		{
			NoRollbackRuleAttribute rr = new NoRollbackRuleAttribute("System.Exception");
			Assert.IsTrue(rr.GetDepth(typeof(SystemException)) > 0);
			Assert.IsTrue(rr.GetDepth(typeof(ApplicationException)) > 0);
			Assert.IsTrue(rr.GetDepth(typeof(DataException)) > 0);
			Assert.IsTrue(rr.GetDepth(typeof(TransactionSystemException)) > 0);
		}
コード例 #2
0
        public void AlwaysTrue()
        {
            NoRollbackRuleAttribute rr = new NoRollbackRuleAttribute("System.Exception");

            Assert.IsTrue(rr.GetDepth(typeof(SystemException)) > 0);
            Assert.IsTrue(rr.GetDepth(typeof(ApplicationException)) > 0);
            Assert.IsTrue(rr.GetDepth(typeof(DataException)) > 0);
            Assert.IsTrue(rr.GetDepth(typeof(TransactionSystemException)) > 0);
        }
コード例 #3
0
        protected override ITransactionAttribute FindTransactionAttribute(Attribute[] attributes)
        {
            if (attributes == null)
            {
                return(null);
            }
            foreach (Attribute attr in attributes)
            {
                if (attr is TransactionAttribute)
                {
                    TransactionAttribute          ta   = (TransactionAttribute)attr;
                    RuleBasedTransactionAttribute rbta =
                        new RuleBasedTransactionAttribute();

                    //TODO another reminder to sync property names
                    rbta.PropagationBehavior       = ta.TransactionPropagation;
                    rbta.TransactionIsolationLevel = ta.IsolationLevel;
                    rbta.ReadOnly           = ta.ReadOnly;
                    rbta.TransactionTimeout = ta.Timeout;

#if NET_2_0
                    rbta.EnterpriseServicesInteropOption = ta.EnterpriseServicesInteropOption;
#endif
                    Type[] rbf = ta.RollbackFor;

                    IList rollBackRules = new ArrayList();

                    if (rbf != null)
                    {
                        foreach (Type t in rbf)
                        {
                            RollbackRuleAttribute rule = new RollbackRuleAttribute(t);
                            rollBackRules.Add(rule);
                        }
                    }


                    Type[] nrbfc = ta.NoRollbackFor;

                    if (nrbfc != null)
                    {
                        foreach (Type t in nrbfc)
                        {
                            NoRollbackRuleAttribute rule = new NoRollbackRuleAttribute(t);
                            rollBackRules.Add(rule);
                        }
                    }

                    rbta.RollbackRules = rollBackRules;

                    return(rbta);
                }
            }
            return(null);
        }
コード例 #4
0
		public void Ancestry()
		{
			NoRollbackRuleAttribute rr = new NoRollbackRuleAttribute("System.Exception");
			Assert.IsTrue(rr.GetDepth(typeof(DataException)) == 2);
		}
コード例 #5
0
		public void NotFound()
		{
			NoRollbackRuleAttribute rr = new NoRollbackRuleAttribute("System.Data.DataException");
			Assert.IsTrue(rr.GetDepth(typeof(ApplicationException)) == -1);
		}
コード例 #6
0
		public void FoundImmediatelyWithClass()
		{
			NoRollbackRuleAttribute rr = new NoRollbackRuleAttribute(typeof(Exception));
			Assert.IsTrue(rr.GetDepth(typeof(Exception)) == 0);
		}
コード例 #7
0
		public void FoundImmediatelyWithString()
		{
			NoRollbackRuleAttribute rr = new NoRollbackRuleAttribute("System.Exception");
			Assert.IsTrue(rr.GetDepth(typeof(Exception)) == 0);
		}
コード例 #8
0
        protected override ITransactionAttribute FindTransactionAttribute(Attribute[] attributes)
        {
            if (attributes == null)
            {
                return null;
            }
            foreach (Attribute attr in attributes)
            {
                if (attr is TransactionAttribute)
                {
                    TransactionAttribute ta = (TransactionAttribute)attr;
                    RuleBasedTransactionAttribute rbta = 
                        new RuleBasedTransactionAttribute();

                    //TODO another reminder to sync property names
                    rbta.PropagationBehavior = ta.TransactionPropagation;
                    rbta.TransactionIsolationLevel = ta.IsolationLevel;
                    rbta.ReadOnly = ta.ReadOnly;
                    rbta.TransactionTimeout = ta.Timeout;

#if NET_2_0
                    rbta.EnterpriseServicesInteropOption = ta.EnterpriseServicesInteropOption;
#endif
                    Type[] rbf = ta.RollbackFor;

                    IList rollBackRules = new ArrayList();

                    if (rbf != null)
                    {
                        foreach (Type t in rbf)
                        {
                            RollbackRuleAttribute rule = new RollbackRuleAttribute(t);
                            rollBackRules.Add(rule);
                        }
                    }


                    Type[] nrbfc = ta.NoRollbackFor;

                    if (nrbfc != null)
                    {
                        foreach (Type t in nrbfc)
                        {
                            NoRollbackRuleAttribute rule = new NoRollbackRuleAttribute(t);
                            rollBackRules.Add(rule);
                        }
                    }

                    rbta.RollbackRules = rollBackRules;

                    return rbta;

                }
            }
            return null;
        }
コード例 #9
0
        public void Ancestry()
        {
            NoRollbackRuleAttribute rr = new NoRollbackRuleAttribute("System.Exception");

            Assert.IsTrue(rr.GetDepth(typeof(DataException)) == 2);
        }
コード例 #10
0
        public void NotFound()
        {
            NoRollbackRuleAttribute rr = new NoRollbackRuleAttribute("System.Data.DataException");

            Assert.IsTrue(rr.GetDepth(typeof(ApplicationException)) == -1);
        }
コード例 #11
0
        public void FoundImmediatelyWithClass()
        {
            NoRollbackRuleAttribute rr = new NoRollbackRuleAttribute(typeof(Exception));

            Assert.IsTrue(rr.GetDepth(typeof(Exception)) == 0);
        }
コード例 #12
0
        public void FoundImmediatelyWithString()
        {
            NoRollbackRuleAttribute rr = new NoRollbackRuleAttribute("System.Exception");

            Assert.IsTrue(rr.GetDepth(typeof(Exception)) == 0);
        }