Adding Behaviors to ActionResults

January 28, 2011 Leave a comment

One problem you have with MVC is that you often need to tweak action response and add additional functionally to them. One solution is to sub class. The issues here you end up with a mess of classes and a deep inheritance tree. One solution decorator pattern.

public class ActionResultDecorator : ActionResult
    {

        protected ActionResult WrappedAction { get; private set; }

        public ActionResultDecorator(ActionResult wrappedActionResult)
        {
            WrappedAction = wrappedActionResult;
        }

        public override void ExecuteResult(ControllerContext context)
        {
            WrappedAction.ExecuteResult(context);
        }
    }

     public class MimeTypeActionResultDecorator : ActionResultDecorator
    {

        public string MimeType { get; set; }

        public MimeTypeActionResultDecorator(ActionResult wrappedActionResult)
            : base(wrappedActionResult)
        {
        }

        public override void ExecuteResult(ControllerContext context)
        {
            context.HttpContext.Response.ContentType = MimeType;
            base.ExecuteResult(context);
        }
    }


Simple solution like a Russian doll.

Blair

Advertisements

List of Books for Sales

January 23, 2011 Leave a comment

We have the following books for sale:

Design Patterns in C# : $40 as new
Professional C# 2.0 : $20 – Markings made to item
Beginning ASP.NET MVC – $30
C# 3.0 in a nutshell – $35
.NET Domain Driven Design with C# – $35
C++ How to program Third Edition – $15 – Markings made to item
Visual C# 2005 – $25
Visual C++ 2005 = $35
ASP.NET 2.0 – $25
CLR via C# 2.0 – $30
Beginning Unix = $30
Prof ASP.NET 2.0 Ajax – $25
Beginning ASP.NET Databases – $30
Professional Hibernate – $15
Mac OS X Snow Leopard Portable Genius – $20
C# 2008 Thread Programming – $35
Event Driven Architecture – $35
Design Patterns Elements of Re-usable object oriented software – $40
Definitive guide to enterprise library – $20
Exploring C++ – $35
Introducing Microsoft LINQ – $20
Gurus guide to Transact SQL – $15
Linq unleashed – $30
Programming ms asp.net 3.5 – $20 – marked
working with ms dynamics crm 4.0 2nd edition – $35
programming visual basic 2005 the language – $25
professional sharepoint development 2007 – $25
microsoft .net framework 2.0 application development foundation training kit – $40
ms .net framework 3.5 wcf training kit – $40
ms applications = code + plus markup – $40
windows forms 2.0 programming – $20
databinding with windows forms 2.0 – $30
microsoft programming windows forms – $20 – marked
microsoft .net framework 3.5 – windows forms training kit – $40

done ms me at system.predicate@gmail.com if your keen.

Blair

Categories: Development, General

Desktop PC for Sale

January 7, 2011 Leave a comment

Hi Guys,

I have tooooo many computers in this house and I need to get sell one.

I have a desktop pc with the following specs – Quad Core, 8 GB Ram, 2 TB Disk Space. 512 MB Graphics Card.

2 Samsung Monitors that are the same model. I think they are 17 Inch or 19 inch.

I am selling the lot including the Keyboard and Mouse for $750 ono.

Let me know if you are interested. It a really beast 🙂

Send me an email to system.predicate@gmail.com.

Blair

UPDATED: SOLD

Categories: General

Facebook Removed

January 7, 2011 Leave a comment

I have removed my self from Facebook for the same reason as the Twitter Post 🙂

Categories: Development

Awesome XKCD

January 7, 2011 Leave a comment

Cool

Love it. Blair.

Categories: Development, General

Books for Sale Part 1

January 7, 2011 Leave a comment

I have a whole heap of Software Engineering books at home which I am going to be selling really cheap as I have read them and have too many books now to store on my bookshelf. I f you interested email me and I’ll let you know what books are available.

Most of them will only be about $15 to $20 dollars so there pretty cheap compared to Borders or Boffins.

I will update this blog once I get a list of all books I am selling so watch this space.

The buyer will be responsible for collecting and this offer will only be to Perth residence.

Blair

Categories: Development, General Tags: ,

Deletion of Twitter Account

January 7, 2011 Leave a comment

Hi all,
you maybe wondering what happened to my twitter account? Well I deactivated it. Why? I was following so many people and you can waste so much time that you could be doing other things, like reading or something more educational.

You can still get me on my blog and people who have my email address can still contact me.

Blair.

Categories: Development Tags: