Best Pracitce check


Presently I was working with delete actions on table for code review task. My requirement is if there is delete method contains the delete_from I have to use delete action(Cascade). If any one can explain regarding this one how to write a class to check the Best Practice in this theme. Any alternate?




What is the BP message you are getting in compilation.


Hi kumaran my requirement is I have to check delete action (cascade is existed). if in method delete where delete_from I is used for deleting records from both tables instead of that one have to take cascade delete action in delete action. Now I need one class or job to find out the delete_from is used.

Let me know if any solution for this because its Microsoft BestPractice Check.



There exists already a class for BP checks on table,


Take a look at \Classes\SysBPCheckMemberFunction\checkAOS, to know how the TextBuffer class is used to search a code with specific text.

Hi Kranthi,

I already checked this once here my requirement is how to identify the method which was having “delete_from” and how to reduce this one by using delete action ‘cascade’ instead of “delete_from” .

For that purpose the textBuffer is used

let me know regarding this with any example.



Have you looked at \Classes\SysBPCheckMemberFunction\checkAOS? it uses textBuffer to find if the code has delete_from

It uses \Classes\SysScannerClass for that purpose.

I checked everything but I need one method(Job) by that method I can found “delete_from” in entire table level methods. For reducing the performance issues.

Any one can say how to create a BP class for “Delete_from” in table methods.

Is any one can explain regarding delete action best practice by classes

If you want some answers, you should do much better job when explaining your problem. What is “can explain regarding delete action best practice by classes” supposed to mean? Do you really think that anybody can understand it?

You should also focus on a concrete problems. For example, if you don’t know how to find delete_from statements in code, why don’t you say it clearly? If you ask for “any solution for this because its Microsoft BestPractice Check”, nobody knows what you actually need and therefore you get no answers.

It meant How to create a class that prevent show a best practice on delete action. If in a table method having delete_from instead of that we have say one best practice error that better to use cascade delete action for that.

Yes, I know, but which specific part you don’t understand? Finding delete_from? Adding the rule to BP checker? Both? Something else?

I have to create one Class that will check this requirement on the project. the class will take care about the Delete Action best Practice if any let me know

Class has to check the table for the best practice regarding the delete Action where in table methods if delete_from is existed for that one, have to show best practice instead of delete_from have to go for cascade delete action

In BP Checker have to add some code for my requirement

In Bp checker it has to be

code should be in BP Checker

You have to add your rule to appropriate SysBPCheck* classes, such as SysBPCheckMemberFunction. You can also create a parameter allowing to disable your rule. Please look at implementation of other rules and if you need some help, explain your specific problem.