Visual Studio

Set your IHttpHandlers using RouteTable rather than web.config

Mira Javora

If for whatever reason you use IHttpHandlers in your MVC project, it may be that you are still using web.config to set the path to the handlers. This can get tricky and easy to miss, especially if you move from cassini dev to IIS7 live.

There is however a better, neater way to declare paths to your handers. If you are using MVC, you can register the handlers in RouteTable, along with your other routes. All you need to do is implement IRouteHandler interface and register a route using your custom route handler.

Auto Wire-Up Your Model Binders ASP.NET MVC

Mira Javora

Model binding in MVC attempts to map values from IValueProviders to your specified model. The value providers (FormValueProvider, QueryStringValueProvider, HttpFileCollectionValueProvider, RouteDataValueProvider, JsonValueProviderFactory … ) abstract the actual value retrieval and binders then handle the value mapping onto the model.

You can create custom model binders to abstract and centralise complex mapping logic that would otherwise end up in your controllers or services. When dealing with a larger number of binders, it is good to refactor common logic and enable wiring up of the new binders easily. Instead of having to register each binder one-by-one in global or prefix the type in the actions, we can create our own model binder broker to replace the default MVC DefaultModelBinder.

Setting Properties In Models With Strongly Typed Model Filters ASP.Net MVC C#

Mira Javora

I like strongly typed view models in MVC. Typical structure of my site in Razor View Engine includes a page base model that is used in the Layout template and then I use inheritance to add properties to each model or commonly re-used properties. There are various reasons why to avoid dynamic in your models, besides the fact that you cannot use dynamic in master frame using razor.

SASS with Visual Studio Part 3 Real World

Mira Javora

Since I already covered the intro, install, features and syntax of SASS. It’s time to show some real-world application of SASS. If used properly, SASS can really save you time.

SASS with Visual Studio Part 2 Features and Syntax

Mira Javora

SASS is a super-set of CSS, that means, any existing CSS that you already wrote will just work. What we usually do, is paste any legacy CSS (if any) to our SASS file and take it from there. I’ve posted few examples of the syntax below. In my next post, I will focus on the real-world usage of SASS.

SASS with Visual Studio Part 1 Introduction

SASS with Visual Studio Part 1 Introduction

Mira Javora

Syntactically Awesome Stylesheets (SASS) aims to make writing CSS easy, re-usable and less repetitive. The new SCSS (Sassy CSS) syntax makes use of variables, mixins, nested rules and inheritance to achieve this goal. Furthermore, I will show you how to use compass to leverage in-built functionality. This series of posts will not argue between SASS and LESS, it will be a quick guide on how to get up and running with SASS within VS and how SASS can help you.