private static RuleCodeDomStatement GetStatement(CodeStatement statement) { Type type = statement.GetType(); if (type == typeof(CodeExpressionStatement)) { return(ExpressionStatement.Create(statement)); } if (type == typeof(CodeAssignStatement)) { return(AssignmentStatement.Create(statement)); } NotSupportedException exception = new NotSupportedException(string.Format(CultureInfo.CurrentCulture, Messages.CodeStatementNotHandled, new object[] { statement.GetType().FullName })); exception.Data["ErrorObject"] = statement; throw exception; }
private static RuleCodeDomStatement GetStatement(CodeStatement statement) { Type statementType = statement.GetType(); RuleCodeDomStatement wrapper = null; if (statementType == typeof(CodeExpressionStatement)) { wrapper = ExpressionStatement.Create(statement); } else if (statementType == typeof(CodeAssignStatement)) { wrapper = AssignmentStatement.Create(statement); } else { string message = string.Format(CultureInfo.CurrentCulture, Messages.CodeStatementNotHandled, statement.GetType().FullName); NotSupportedException exception = new NotSupportedException(message); exception.Data[RuleUserDataKeys.ErrorObject] = statement; throw exception; } return(wrapper); }