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);
		}
Exemplo n.º 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);
        }
Exemplo n.º 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;
        }
Exemplo n.º 9
0
        public void Ancestry()
        {
            NoRollbackRuleAttribute rr = new NoRollbackRuleAttribute("System.Exception");

            Assert.IsTrue(rr.GetDepth(typeof(DataException)) == 2);
        }
Exemplo n.º 10
0
        public void NotFound()
        {
            NoRollbackRuleAttribute rr = new NoRollbackRuleAttribute("System.Data.DataException");

            Assert.IsTrue(rr.GetDepth(typeof(ApplicationException)) == -1);
        }
Exemplo n.º 11
0
        public void FoundImmediatelyWithClass()
        {
            NoRollbackRuleAttribute rr = new NoRollbackRuleAttribute(typeof(Exception));

            Assert.IsTrue(rr.GetDepth(typeof(Exception)) == 0);
        }
Exemplo n.º 12
0
        public void FoundImmediatelyWithString()
        {
            NoRollbackRuleAttribute rr = new NoRollbackRuleAttribute("System.Exception");

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