Showing posts with label Csla. Show all posts
Showing posts with label Csla. Show all posts

Friday, May 7, 2010

Creating Csla Attribute Based E-mail Validator

With Csla 3.8, you can now use the System.ComponentModel.DataAnnotations feature set to write business validation rules.

One of the neat features of the Csla implementation is that it will work with the normal System.ComponentModel.DataAnnotations feature set in technologies that support it, as well as, provide a secondary validation with the Csla validation engine.

For example, this is a Csla property that contains all of the necessary validation:
private static PropertyInfo NameProperty = RegisterProperty(c => c.Name);

[Required, RegularExpression(@"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$")]
public string Email
{
get { return GetProperty(NameProperty); }
set { SetProperty(NameProperty, value); }
}

Here we are validating that the Email property matches the validation regular expression, which works.... but what if you want to create your own attribute based validations.

Well,the ValidationAttribute(s) contained within the System.ComponentModel.DataAnnotations support an inheritance model, and you can design your own. For example a common e-mail validation:
public class EmailValidation : RegularExpressionAttribute
{
public EmailValidation()
: base(@"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$")
{}

public override bool IsValid(object value)
{

return base.IsValid(value);
}
}

This can then be used as an attribute validation on your property:
private static PropertyInfo NameProperty = RegisterProperty(c => c.Name);
[Required, EmailValidation]
public string Name
{
get { return GetProperty(NameProperty); }
set { SetProperty(NameProperty, value); }
}

Resources:
Csla
System.ComponentModel.DataAnnotations

Thursday, November 12, 2009

CSLA .NET 3.8.1 available

From the Csla .NET Discussion Board:

Feed: CSLA .NET discussion
Posted on: Tuesday, November 10, 2009 3:03 PM
Author: RockfordLhotka
Subject: CSLA .NET 3.8.1 available

I've put CSLA .NET 3.8.1 online for download. The only difference between this and 3.8.0 is that in 3.8.1 the Csla project has no dependency on ASP.NET MVC.
Let no one say that I disregard community feedback (outcry?) when I do something wrong :)


View article...

Friday, December 26, 2008

Csla 3.6 and Expert C# Business Objects 2008 Released...

Version 3.6 of Csla .NET for Windows and Csla.NET for Silverlight have been released, and are available for download on Rockford Lhotka's website: http://www.lhotka.net/.

You can download the new versions of the framework from Lhotka.net, on the download page: http://www.lhotka.net/cslanet/download.aspx

The accompanying book is already available for purchase. You can get more information on the book, published by APress here: http://www.apress.com/book/view/9781430210191

This is the description of the book directly from APress:

Expert C# 2008 Business Objects
Do you want to create .NET applications that provide high performance and scalability? Do you want to employ object–oriented programming techniques in a distributed environment? Do you want to maximize the reuse and maintainability of your code? Then this book is for you.

In Rockford Lhotka’s Expert C# 2008 Business Objects, you’ll learn how to use advanced .NET Framework capabilities alongside OO design and programming to create scalable, maintainable object–oriented applications. Better still, this book includes CSLA .NET 3.6, a widely used framework on which you can base your application development. By using the concepts and framework in the book, you can focus more on your business issues and less on technology.

Using VS 2008 and C# 3.0, Rockford Lhotka shows you how CSLA .NET 3.6 allows great flexibility in object persistence, so business objects can use virtually any data sources available. The CSLA framework supports 1–, 2– and n–tier models through the concept of mobile objects. This provides the flexibility to optimize performance, scalability, security, and fault tolerance with no changes to code in the UI or business objects.

Business objects based on CSLA.NET 3.6 automatically gain many advanced features that simplify the creation of Windows forms, web forms, WPF, WCF, WF, and web services interfaces, and LINQ.


Resources:
APress
CSLA .NET 3.6 for Windows and for Silverlight is released!
Download

Wednesday, August 27, 2008

Csla 3.5.1 on DnrTV

Rocky Lhotka has just posted on his blog about the release of the dnrTV (Dot Net Rocks TV) episodes on CSLA .NET 3.5.1

You can read his blog post about it here:
http://www.lhotka.net/weblog/CSLANETOnDNRTV.aspx

You can view the show (it's in two parts), by clicking on these links:
Rocky Lhotka on CSLA .NET 3.5 Part 1
Rocky Lhotka on CSLA .NET 3.5 Part 2

This is the link to the Csla home page: http://www.lhotka.net/cslanet/Default.aspx