locked
Fxcop CustomRule to Identify method call RRS feed

  • Question

  • Hi all

     I want to write a custome rule to Avoid mutliple invocations from UI layer to Business Logic layer in a single transaction.Is it possible to do that.

    Wednesday, August 8, 2012 10:19 AM

Answers

  • It wouldn't make a very generic rule unless you keep some sort of naming conventions in place or use some type of attribute at the Assembly, Type or Method level in the Business Logic and UI.

    That said, finding all method calls inside another method is very simple. Then somehow checking your naming guideline or attributes isn't too hard either. Then if you know which method calls quality as "To business logic layer", then it's peanuts to check whether more than one method was called.

    If there is no naming guideline in place or no attribute that you can use to identify the methods in question, then I don't see an easy way to accomplish this (other than introducing one of the above methods).


    My blog: blog.jessehouwing.nl

    Wednesday, August 8, 2012 2:25 PM
  • Thanks for your reply Jesse.I will check the link you provided.
    • Marked as answer by Vasanthg Thursday, August 9, 2012 5:42 AM
    Thursday, August 9, 2012 5:41 AM

All replies

  • It wouldn't make a very generic rule unless you keep some sort of naming conventions in place or use some type of attribute at the Assembly, Type or Method level in the Business Logic and UI.

    That said, finding all method calls inside another method is very simple. Then somehow checking your naming guideline or attributes isn't too hard either. Then if you know which method calls quality as "To business logic layer", then it's peanuts to check whether more than one method was called.

    If there is no naming guideline in place or no attribute that you can use to identify the methods in question, then I don't see an easy way to accomplish this (other than introducing one of the above methods).


    My blog: blog.jessehouwing.nl

    Wednesday, August 8, 2012 2:25 PM
  • Thanks for your reply Jesse.I will check the link you provided.
    • Marked as answer by Vasanthg Thursday, August 9, 2012 5:42 AM
    Thursday, August 9, 2012 5:41 AM