Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
252 views
in Technique[技术] by (71.8m points)

c# - Validate assemblies and namespaces in VAB config file

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

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

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...