protected void SetAbort()
        {
            DataContextAttribute dca = ExtractNestedContextAttribute();

            if (dca == null)
            {
                return;
            }

            ContextManager.Instance.SetAbort(dca.ContextName);
        }
        private DataContextAttribute ExtractNestedContextAttribute()
        {
            StackTrace stackTrace = new StackTrace();

            StackFrame[] stackFrames = stackTrace.GetFrames();
            foreach (StackFrame stackFrame in stackFrames)
            {
                MethodBase method = stackFrame.GetMethod();
                object[]   attrs  = method.GetCustomAttributes(typeof(DataContextAttribute), false);
                if (attrs.Length > 0)
                {
                    DataContextAttribute dca = attrs[0] as DataContextAttribute;
                    return(dca);
                }
            }
            return(null);
        }