internal static void CheckWithAndThrow(this DbNode node, string argument, string method) { if (node == null) { throw new QueryTalkException("Common.CheckTable", QueryTalkExceptionType.ArgumentNull, String.Format("{0} = null", argument), method); } if (!(node is ITable)) { throw new QueryTalkException("Common.CheckTable", QueryTalkExceptionType.InvalidWith, String.Format("{0} = {1}", argument, DbMapping.GetNodeName(node.NodeID)), method); } }
internal static void ThrowInvalidQuantifierException( Predicate predicate, DbNode subject, ISemantic predicateSentence, DbNode intermediate, string predicateExpression) { DbNode predicateNode = null; if (predicateSentence != null) { predicateNode = (predicateSentence.Subject != null) ? predicateSentence.Subject : null; } if (intermediate != null) { throw new QueryTalkException("Translate.ThrowInvalidQuantifierException", QueryTalkExceptionType.QuantifierDisallowed, String.Format("subject = {0}{1} predicate node (intermediate) = {5}{1} given predicate node = {2}{1} predicate expression = {3}{1} quantifier = {4}", subject != null ? DbMapping.GetNodeName(subject.NodeID).Sql : Text.NotAvailable, Environment.NewLine, predicateNode != null ? DbMapping.GetNodeName(predicateNode.NodeID).Sql : Text.NotAvailable, predicateExpression != null ? predicateExpression : Text.NotAvailable, predicate.Quantifier != null ? predicate.Quantifier.QuantifierType.ToString() : Text.NotAvailable, intermediate.Name), Text.Method.PredicateMethod).SetExtra("Pay attention to the intermediate predicate node which was provided by the library since the subject and the given predicate node are not related directly to each other."); } else { throw new QueryTalkException("Translate.ThrowInvalidQuantifierException", QueryTalkExceptionType.QuantifierDisallowed, String.Format("subject = {0}{1} predicate node = {2}{1} predicate expression = {3}{1} quantifier = {4}", subject != null ? DbMapping.GetNodeName(subject.NodeID).Sql : Text.NotAvailable, Environment.NewLine, predicateNode != null ? DbMapping.GetNodeName(predicateNode.NodeID).Sql : Text.NotAvailable, predicateExpression != null ? predicateExpression : Text.NotAvailable, predicate.Quantifier != null ? predicate.Quantifier.QuantifierType.ToString() : Text.NotAvailable), Text.Method.PredicateMethod); } }