Tag Archives: MVC4

Turning off validation for properties in a MVC model

Sometimes it is required that some properties in a MVC model should not be validated, but the rest are required and should be validated in the client view. Mostly I cannot turn off client validation for all properties in the model. Here is an example of a Model class. I need to validate 2 properties […]

MVC Async File Upload

To use the upload html control inside an ajax request, the following steps need to be taken: Define an ajax function for the upload button Define the form for the upload Add the input file control to the form Handle the file in the MVC controller Return the json result, wrapped in a text item […]

WiX installer for MVC4 project

This example shows how a MVC4 solution can be setup together with a WiX installation project. To create a msi installer for a MVC4 project, the solution needs to be built, then the web project must be published, the WiX project harvests the published output and creates an msi installer. The solution is configured so […]

Enterprise Library 6, Unity 3 InterfaceInterceptor with MVC 4, Part 4

This post continues on from the previous post. Part 3 Enterprise Library 6, Unity 3 and MVC 4, Registration by Convention Part 3 Microsoft.Practices.Unity.Interception Unity provides both instance and type interception, and enables interception with either objects you resolve through the container, or by using the stand-alone API to explicitly invoke interception on a known […]

Enterprise Library 6, Unity 3 and MVC 4, Registration by Convention Part 3

This post continues on from the previous post. Part 2 Enterprise Library 6, Unity 3 and MVC 4, LifetimeManagers Part 2 The MVC application with unity is starting to take shape. It would be better if the registration by convention method could select which interfaces with which lifetime manager should be registered and only the […]

Enterprise Library 6, Unity 3 and MVC 4, LifetimeManagers Part 2

This is an example of an MVC Application using Register by Convention and Unity.MVC Use nuget to add Unity.MVC to the MVC4 application. (Unity bootstrapper for ASP.NET MVC 3.0.1304.0) Now edit the UnityMvcActivator in the App_Start folder. The following code must be included. Then change the UnityConfig class. Add a custom function and use this […]

Enterprise Library 6, Unity 3 with ASP.NET MVC 4 Part 1

This example shows you how to setup a simple ASP.NET MVC 4 application using Enterprise Library Unity 3 for its dependency injection. Firstly use nuget to add the Unity 3 package: Create a new static class which will be used to get the root UnityContainer. Create a new class which inherits from the DefaultControllerFactory, otherwise […]