Posts Tagged ‘C#’

Model-based validation for ASP.NET MVC (concept)

2 Comments » | Wednesday, August 20th, 2008

MVC is definitely the way to go for the future but ASP.NET MVC Preview 4 (the latest release) still lacks in lot of different areas. One of the most essential missing features is some kind of validation and I am not the only one who needs this stuff right now. That’s why I have written a few lines for validating my forms. It’s basically a concept which is not ready for production but I want to share it with you a get some feedback.

(more…)

Validating culture name using LINQ

No Comments » | Tuesday, July 22nd, 2008

Imagine that we have some class (e.g. UserProfile) with Culture property for storing a culture specific string, in other words a culture name.

class UserProfile
{
    private string _culture;

    public string Culture
    {
        get { return _culture; }
        set { _culture = value; }
    }
}

Our goal is to allow only existing culture name to be set and avoid an invalid one. Let’s start by writing unit tests where we will try to assign valid and invalid values to our property (using MSTest):

(more…)

Hostgator is going to host .NET sites in the nearly future