DCSIMG
PostSharp - Doron's .NET Space

Browse by Tags

All Tags » PostSharp (RSS)

Using AOP and PostSharp to Enhance Your Code: Part B

At the last part we talked a little about post compiling, AOP and how we can use the PostSharp tool to make our code look a lot better. At this part I want to get a little more deep inside the mechanism behind this cool feature, and I'll do this by first showing another example. The Logging Attribute Let's say you want to create an attribute that enables you to log a method, including when you entered the method, the arguments it received and it's processing time. Sounds useful, no? Let's see how...
Posted by dorony | 3 comment(s)
תגים:,

Using AOP and PostSharp to Enhance Your Code: Part A

Click here for Part B I've been looking at ways to improve the quality of my team's code by removing "unrelated" code from within methods. By that I mean things like opening transactions, caching and exception handling. For instance, code like that might be quite common: public object GetSomething() { try { object o = HttpContext.Current.Cache[ " MySomething " ]; if (o == null ) return o; using (TransactionScope scope = new TransactionScope()) { o = DataAccess.ActuallyGetSomething(); scope.Complete...
Posted by dorony | 13 comment(s)
תגים:,