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);
        }
		public void Ancestry()
		{
			NoRollbackRuleAttribute rr = new NoRollbackRuleAttribute("System.Exception");
			Assert.IsTrue(rr.GetDepth(typeof(DataException)) == 2);
		}
		public void NotFound()
		{
			NoRollbackRuleAttribute rr = new NoRollbackRuleAttribute("System.Data.DataException");
			Assert.IsTrue(rr.GetDepth(typeof(ApplicationException)) == -1);
		}
		public void FoundImmediatelyWithClass()
		{
			NoRollbackRuleAttribute rr = new NoRollbackRuleAttribute(typeof(Exception));
			Assert.IsTrue(rr.GetDepth(typeof(Exception)) == 0);
		}
		public void FoundImmediatelyWithString()
		{
			NoRollbackRuleAttribute rr = new NoRollbackRuleAttribute("System.Exception");
			Assert.IsTrue(rr.GetDepth(typeof(Exception)) == 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);
        }