public static CodeStatementCollection BuildDetectChangedMembers(TableViewTableTypeBase table)
{
CodeStatementCollection ValidationSetStatement = new CodeStatementCollection();
String PocoTypeName = "this";
ValidationSetStatement.Add(new CodeSnippetExpression("Boolean bResult = new Boolean()"));
ValidationSetStatement.Add(new CodeSnippetExpression("bResult = false"));
foreach (Column c in table.Columns)
{
MemberGraph mGraph = new MemberGraph(c);
CodeConditionStatement csTest1 = new CodeConditionStatement();
if (mGraph.IsNullable)
{
csTest1.Condition = new CodeSnippetExpression(PocoTypeName + "." + mGraph.PropertyName() + ".HasValue == true");
csTest1.TrueStatements.Add(new CodeSnippetExpression("bResult = true"));
}
else
{
csTest1.Condition = new CodeSnippetExpression(PocoTypeName + "." + mGraph.PropertyName() + " == null");
csTest1.TrueStatements.Add(new CodeSnippetExpression(""));
csTest1.FalseStatements.Add(new CodeSnippetExpression("bResult = true"));
}
}
return ValidationSetStatement;
}