Development With A Dot
Blog on development in general, and specifically on .NET. Created and maintained by Ricardo Peres.
-
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!