Archives
-
ASP.NET MVC Training Kit Released
Get it here.
-
Enterprise Library 4.1 and Unity 1.2 Hands-on Labs Download - Patterns & Practices
Good news: the long-promised Hands-on Labs for Unity has been released!
-
Changing Thread-Safety Dynamically
Sometimes there may be a need to decide dynamically (through code in your program) whether a class is thread-safe or not. This is the technique I use:
-
ASP.NET MVC 1.0 Released
Get it from http://www.codeplex.com/aspnet, including source code and a sample project.
-
Interface Inheritance
I am normally against having an interface inherit from another one, but there's a situation where I am in favor of it: web service interfaces!
-
Enterprise Library 5 Wish List
Updated!
-
Setting Custom Identity in WCF
WCF was designed to be fully extensible, at all levels. If I want to pass a custom identity (an application-defined username and role and the desired culture) to a WCF web service (not using ASP.NET compatibility mode), this is what I do:
-
Catch All Exceptions
As you may know, an exception is always thrown in the context of a running thread; what happens if there is no try...catch block protecting that thread? The exception is propagated to the application domain level, where, eventually, it will cause your application to crash.
-
ASP.NET Validation with the Enterprise Library Validation Block
The Enterprise Library comes with a custom ASP.NET validator, that gets validation from the metadata defined in your classes. If you have seen my previous post, you know how to add validation metadata to a POCO, usually a data transfer object. Basically, you either 1) add attributes to public properties and fields or 2) configure XML files. I'll stick to the first approach. What I'll show you next is how to do validation on web forms based on the validation metadata from a class. First, add a reference to the Microsoft.Practices.EnterpriseLibrary.Validation.Integration.AspNet assembly, and enter the following markup on you ASPX page:
-
Validation of WCF Requests with the Enterprise Library Validation Block
In order to enable validation of the properties of a request message, you only need to add a [ValidationBehavior] attribute to your service interface, just next (or before) the [ServiceContract], and a [FaultContract(typeof(ValidationFault))] on the method declaration. The ValidationBehaviorAttribute and ValidationFault classes are defined in the Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WCF assembly and are part of the Validation Application Block of the Enterprise Library 4.1, more specifically, of the WCF integration module.
-
New Cumulative Update for SharePoint Released
A new cumulative update for SharePoint (actually one for WSS and another one for MOSS) has been released.
-
ASP.NET Page Events Lifecycle
When using master pages, the normal page event lifecycle is a little different. Here is the actual order:
-
Enterprise Library Lifetime Managers
Update: fixed a bug in the attached code.
-
Dependency Injection on an ASP.NET Page
In order to have dependency injection on your ASP.NET pages, the best way to go is through a customized page handler factory. A page handler factory is a class directly or indirectly derived from PageHandlerFactory who has the responsibility to create a new instance of a Page. What we do is, we call the base class implementation of GetHandler method and then we call IUnityContainer's BuildUp method. Of course, we must also
-
Enterprise Library Call Handlers
Call Handlers are Enterprise Library's extension mechanism. They allow code to be injected before or after a method is called. Enterprise Library, as of version 4.1, comes with the following call handlers and associated handler attributes, in assembly Microsoft.Practices.EnterpriseLibrary.PolicyInjection.CallHandlers:
-
Calling Web Service Methods Synchronously in ASP.NET AJAX
Update: I had forgot to send the code for the synchronous executor. Here it is, as an attachment.
-
No-Compile Web User Controls
When using no-compile web user controls (where the CompilationMode directive is set to Never), you cannot just add them to your web page declaratively.
-
Useful Expression Builders
Expression builders are a cool subject... they work with no-compile pages and provide a lot of declarative power!