tags:

views:

171

answers:

2

Hi,

What is the most innovative usage of C# attributes you've implemented or have seen implemented?

+2  A: 

Before LINQ to SQL (and when I wasn't allowed to use Open Source or Off-The-Shelf ORMs), I built an entire ORM solution using attributes and reflection.

...the crowning achievement was that performance didn't suck.

Justin Niessner
+1 - Same here, and I agree - no performance issues.
Otávio Décio
yeah, did that sort of thing too - and a set of controls where the sdatabinding was via attributes
kpollock
+2  A: 

We implemented a hierarchy of custom attributes using PostSharp to take care of all the validations required for each of the WCF methods.

As the services implement the request/response pattern and the response objects have ErrorCode and ErrorMessage, the attributes also act as a catch-all and returns a Failed response when an exception bubbles up and it'll include the appropriate ErrorCode and message in the response.

It worked really well and we were able to cut out most of our boiler plate code from before :-)

theburningmonk