Visual studio feeds

All Visual Studio blogs in one place


Enter your email address:

Delivered by FeedBurner

Increase your website traffic with



Anti-spam: How many eyes has a typical person?

Follow us on FB


PostSharp Principles: Day 3 - Applying Aspects with Multicasting Part 2

AddThis Social Bookmark Button
Download demo project source code Yesterday we started looking at multicasting. Today we’ll go even further with assembly level declarations and how to prevent aspects from being applied. Assembly Level Declaration At the highest level we have assembly declarations. This is a powerful feature that allows us to achieve many tasks. Before we explore the details, let’s see it in action. Remove any aspect declarations you have currently. Note: Depending on your own tastes, you can apply this assembly declaration in any file. Commonly, these are put in the AssemblyInfo.cs file, but they can
go anywhere. I recommend putting them in relevant class files to keep the visibility or creating an AspectInfo.cs file to keep them in. Putting them in the AssemblyInfo.cs could be a problem since it's a rarely used file. [assembly: PostSharpDemo1.MethodTraceAspect()] namespace PostSharpDemo1 { … } It can be as simple as that. With no other options this declaration will apply our aspect to every method in every class. Run it and check out the results. Oops! There was a problem. We can't build the project because PostSharp is trying to apply our aspect to our aspect. The result of this, at...(Read whole news on source site)

Home : Blog List : SharpCrafters Blog | The official blog of SharpCra : PostSharp Principles: Day 3 - Applying Aspects with Multicasting Part 2