Tag Archives: Enterprise Library

OUT-OF-PROCESS Semantic Logging V2 with Elasticsearch

This article shows how to use Microsoft patterns & practices OUT-OF-PROCESS Semantic Logging Version 2 with an Elasticsearch sink. Version 2 has breaking changes compared to version 1.1 for the Elasticsearch sink; this has been removed from the standard SLAB NuGet package… Due to this, a custom sink configuration is required and also some copy […]

Windows 8 App using Unity 3 IoC

Unity.3.0.1304.1 now supports Windows 8 Apps with the Microsoft.Practices.Unity.NetCore assembly. This is a reduced set of features compared with the full version of Unity. This blog demonstates how this IoC container could be used with a default Windows 8 App. Step 1: Get Unity using nuget: Step 2: Create a UnityHelper class which will be […]

Validation in MVC, Enterprise Library, Fluent Validation, Data Annotations, FoolProof

MVC Validation MVC has many possibilities for validation. Depending on the use case, the correct validation should be used. Here is a list of MVC validation possibilities: Server side Model-level validation Server side Property-level validation Client side Model-level validation Server side Property-level validation Server side custom validation When validating, a number of problems can exist […]

Simple MVC Application using FluentValidation.MVC4

This is a simple example of MVC application using FluentValidation.MVC4. http://fluentvalidation.codeplex.com/ Create a new web application MVC4. Get the fluent validation using nuget: Create a validation rule set class: Now add the attribute to the model class: FluentDataModel Add the Provider to the Global.asax file App_Start() method And the validation works (Note: the dependency validation […]

Simple MVC Application using standard Validation (DataAnnotations)

This is a simple example of standard MVC validation provided in the .NET framework. Create a new MVC application. Edit the index.cshtml file. Important: for client validation to work, the scripts section must be included. (Defined per default in the _Layout View and the BundleConfig.cs in the App_Start folder) Create a Model Edit the web.config […]

Enterprise Library 6, Unity 3, MVC, Validation with Interception ValidationCallHandler Part 5

This post continues on from the previous post. Part 4 Enterprise Library 6, Unity 3 InterfaceInterceptor with MVC 4 In this post a validation call handler will be added using unity 3 with VirtualMethodInterceptor and enteprise library Policy Injection. Enterprise library 6 has the following call handlers (Out of the box): AuthorizationCallHandler ExceptionCallHandler LogCallHandler PerformanceCounterCallHandler […]

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 […]