protected override void OnPropertyNameChanged(CodeTypeMemberExtension memberExtension, string oldName, string newName)
{
OnFieldOrPropertyNameChanged(memberExtension, oldName, newName);
CodeMemberProperty property = (CodeMemberProperty)memberExtension.ExtendedObject;
// Look up for the data binding statement and change the property name there.
foreach (CodeStatement statement in property.SetStatements)
{
CodeExpressionStatement expStatement = statement as CodeExpressionStatement;
// Continue if the statement is not a CodeExpressionStatement.
if (expStatement == null)
{
continue;
}
CodeMethodInvokeExpression miExp = expStatement.Expression as CodeMethodInvokeExpression;
// Continue if the statement is not a CodeMethodInvokeExpression.
if (miExp == null)
{
continue;
}
// Modify the property name in parameters.
foreach (CodeExpression pExp in miExp.Parameters)
{
CodePrimitiveExpression priExp = pExp as CodePrimitiveExpression;
// Continue if the statment is not a CodePrimitiveExpression.
if (priExp == null)
{
continue;
}
if (priExp.Value.ToString() == oldName)
{
priExp.Value = newName;
}
}
}
}