Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

We are using version 4.1 of the validation application block. I am relatively new to it so I was wondering if it had the ability to either abstract out the configured namespaces and assemblies or otherwise provide proper validation of their existence?

We had an issue recently where someone moved a class and didn't update the validation configuration file with the new namespace. As a result the validations were no longer being applied to the object. The application block seems to just ignore the discrepancies. Unfortunately this was not caught during the normal QA cycle. Is there any built in way to protect ourselves from this type of change in the future? What I did in the interim is load up the config xml, extract out all the assemblies and defined namespaces and validate that they all exist.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
241 views
Welcome To Ask or Share your Answers For Others

1 Answer

One of possible solutions that comes to me is using of AOP programming concepts. In short, for example in your case, you mark the "fragile" code with some attibute and at compile time check if the type, member function, property... is in a state you intendt it ti be in.

Like a references:

CSharpCornerArticle-2009 (old but still good one)

PostSharp (may be the best tool on the market now for AOP)

Rolsyn (compiler as a Service provided by MS. You can write your own small parser of C# or VB.NET code and inject it inside you CI environment.

Hope this helps.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...