Postsharp and sanity checks

While playing with Postsharp for a validation framework i stumbled upon this.
This is a great little code block that stops sneaky team members referencing layers they should not be referencing. a compile time error will ensue and let them know, for example, that they can not access the DAL via the View projects… happy days!

4 thoughts on “Postsharp and sanity checks

  1. one thing to keep in mind though is that this kind of stuff does slow down the compilation of the project.If you’re doing TDD, then this can become a bit of a pain when working on large solutions

    Like

  2. Thats true Davy, and post sharp is a signifiacnt delay in compilation. How this would be handled if it became a problem?Possibly a local version of the assinfo.cs with the attribute, but thats pretty messy.Possible use a debug block to comment it out, with the build server using a different build profile… hmm

    Like

  3. yeah, if you’re using the technique just to make sure that nobody is using the wrong stuff in places where they shouldn’t, it might be a good idea to just replace the assemblyinfo.cs file on the buildserver so the check only happens there

    Like

Leave a reply to RhysC Cancel reply