Web Client Sofware Factory and Enterprise Library 3.1 Sample Download

I uploaded a new sample of using the Web Client Software Factory and Enterprise Library 3.1. The sample shows off a number of features:


 


Web Client Software Factory 1.1 Features:




  • View-Presenter Pattern


  • Dependency Injection – [CreateNew] and [ServiceDependency] Attributes


  • Business Module Self-Discovery


  • ObjectContainerDataSource Control

Enterprise Library 3.1 Features:




  • Business Object Validation using Validation Application Block


  • ASP.NET Integration of Validation Application Block to avoid redundant Validation Rules


  • Validation of Method Parameters using Policy Injection Application Block’s ValidationCallHandler


  • Caching of Database Results using Policy Injection Application Block’s CachingCallHandler


  • Data Access Application Block for accessing SQL Server Express Database

Miscellaneous Features




  • AJAX UpdatePanel for Partial-Page Refreshes

I will follow-up with a screencast that walks through the sample, but in the meantime, one can already watch screencasts I already posted on the individual subjects:



 


The example is simple, but as mentioned above, shows off quite a few features that gets you thinking about the possibilities of the Web Client Software Factory and Enterprise Library 3.1.


 



 



 


Validation and Caching 


Validation and caching are reduced to Attributes and Interception by the Policy Injection Application Block which can often be bewildering if you are not used to the functionality. It is described here in the Interface. Note this will explain why you may get a 15 second delay in seeing a new customer in the grid after adding it to the database. I did this on purpose just to show that caching is really happening.


 

public interface ICustomerDAO
{
Customer GetCustomerByCustomerId(
int customerId);

[CachingCallHandler(0,0,15)]
List
<Customer> GetAllCustomers();

[ValidationCallHandler]
void InsertCustomer(Customer customer);

[ValidationCallHandler]
void UpdateCustomer(Customer customer);

void DeleteCustomer(int customerId);
}


 


I talk about that in a few tutorials:



 


ASP.NET Integration of Validation Application Block for UI Validation


The ASP.NET Integration saves you the hassle of adding redundant validation rules in both the presentation and business layers which is sweet. Unfortunately, it takes a postback to do the validation so I added the AJAX UpdatePanel for a better user experience. You will see the PropertyProxyValidator Control as a replacement to what would normally be ASP.NET Validation Controls.


 

<p>Firstname:</p>
<p>
<asp:TextBox ID=txtFirstname/>
<cc1:propertyproxyvalidator id=FirstnameValidator/>
</p>

 


 The PropertyProxyValidator Control will use the ValidatorAttributes on the Business Class to validate the input.


 

public class Customer
{
//

[StringLengthValidator(…)]
[RegexValidator(…)]
public string EmailAddress
{
get { return _emailAddress; }
set { _emailAddress = value; }
}
}

 


I walk through the ASP.NET Integration really in-depth here:


Validation Application Block and ASP.NET Website Integration Sample


 


Hope this helps. We will be talking about much of this at the Tampa CodeCamp in July.


 


by David Hayden


 

This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

One Response to Web Client Sofware Factory and Enterprise Library 3.1 Sample Download

  1. EP says:

    David,

    Do you know how to store Enterprise Library Configuration in a SQL database instead of a configuration file? I am looking at using the Validation Application Block (EL3.1), but using a config file is NOT an option, I need to use a database. I want to set up validation on my business objects, there will be many validation rules and we would want the ability to manage them.

    Thanks in advance.
    EP

    I tried using your contact form on davidhayden.com but it got stuck on validation (Please re-check your information) and it would not let me submit the form at all.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>