DevTrends Blog

The DevTrends technical blog covers .NET, Microsoft Azure, IoC, ASP.NET MVC, Web API, AspNet Core, Open Source releases plus anything else that I find interesting :-)

Displaying page 4 of 4

mvc

Importing Namespaces into Razor Views in ASP.NET MVC 3

The way that namespaces are imported into views is quite different in ASP.NET MVC 3 depending on whether you choose to use the original ASPX view engine or the newer Razor engine. This article discuses these diferences and shows how you can make namespaces available to all views without an explicit import statement in each view. More »

ioc

Configuration Settings Are A Dependency That Should Be Injected

Dependency Injection does not just apply to obvious dependencies such as repositories and logging components. It is very important to inject ALL dependencies including the less obvious ones. In my experience, one of the most overlooked areas is configuration. Many people seem perfectly happy to extract settings from config deep within their code. This is plain wrong. If you need to reference an AppSetting in your business logic, inject it. If you need a connection string in your data access code, inject that too. More »

open source

Introducing The Unity.Mvc3 NuGet Package To Reconcile MVC3, Unity and IDisposable

Most IDependencyResolver implementations using Unity do not work with IDisposable and using them can lead to memory leaks and connection issues. Unity.Mvc3 is an assembly that includes a fuller implementation of IDependencyResolver that uses a child container per web request to ensure that IDisposable instances are disposed of at the end of each request. All of these complexities are taken care of by the assembly and integration into a project is as simple as adding a single line of code. More »

mvc

Do not implement IControllerActivator in ASP.NET MVC 3

ASP.NET MVC 3 introduces two new interfaces to allow simple integration of IoC containers into the MVC pipeline, allowing many different types to be resolved using your IoC container of choice. These interfaces are IDependencyResolver and IControllerActivator but before you go ahead and implement both, let's take a look at whether they are both actually needed. More »

mvc

The Complete Guide To Validation In ASP.NET MVC 3 - Part 2

This is second part our comprehensive guide to ASP.NET MVC 3 validation. In this article, we will write several custom validators by subclassing ValidationAttribute. We will include functionality to output HTML5 data-* attributes for use with client side validation. We will then add the client-side validation and learn about jQuery.validate and the Microsoft adapters that are used to convert the HTML5 data-* attributes into a format that jQuery.validate understands. More »

mvc

The Complete Guide To Validation In ASP.NET MVC 3 - Part 1

The latest release of ASP.NET MVC (version 3) has a number of new validation features that significantly simplify both the validation code AND the html outputted to the client. This two-part article will attempt to cover all common validation scenarios and introduce all the new MVC3 validation features along the way. We will provide detailed explanations as well as full code examples that you can adapt for your own needs. More »

View Newer Posts