asp.net - Call a specific functionality before each function returns in a c# class -
i writing class returns urls generated web project.
i have around 200 functions return urls. @ end of each of these 200 functions, have call specific function process , validate url.
can automated? don't want miss in of 200 functions.
you can automate using programming technique known aspect oriented programming (aop). there couple of aop tools out there, , 1 of known c# postsharp , there edition can use free (note have no affiliation postsharp).
basically happens add attribute class in question , postsharp takes attribute , class , generates new class during compilation phase performs both actions. powerful technique can simplify things validation , logging greatly.
Comments
Post a Comment