views:

181

answers:

2

There are a lot of "primitive" boiler plate types of data classes that could appear in many different programs.

However, I have never seen a class or library set that recognizes the need to combine all these things with common logic required for them such as validation.

Example classes ([] brackets correspond to classes also in hypothetical library):

Address (street, postal code, city, state/territory/province, country)
Person (name, contact info ([Phone]/[Email]/etc), [Address], SSN/TIN, [CreditCard])
Phone (number, country code, etc)
CreditCard (type, number, expiration, ccv) **

And I'm sure someone could come up with plenty of others.

I have developed my own Phone/Address/Person/CreditCard classes that I use in projects, complete with validation and logic.

However I only am capable of validating US based information. My phone number class would ideally inherit from a base Phone class, as mine actually seperates the number into NPA, NXX and Station and validates it fully with NANP standards.

Is there a set of libraries out there in the net that has a comprehensive collection of such boiler plate data classes with proper validation?

Does it include validation for a world wide set of data, or just US data?

And for the ** from CreditCard, is it capable of meeting PCI Data Security Standards?

I know these are classes many people have probably written many times in many different languages, but is there any .NET library that fufills these desires?

I would prefer opens source/free, though I would consider a paid 3rd party library set.

+6  A: 

CSLA.NET might offer close to what yoju're looking for. It probably takes it a bit further than what you are asking, but it has some of the most comprehensive documentation of any framework (ie published books from APress). It is also free.

In particular the CSLA.ValidationRules namespace and the CommonRules and CustomRules classes focus on data validation.

Ash
Wow, definitely an awesome framework for building business logic. I can see it implementing in a very interesting way a lot of functionality I have seen in several projects I have worked on in the past. However I was looking more towards a library/framework of "commonly used classes" which have wide scope of application, like the examples I mentioned.
Aequitarum Custos
+1  A: 

It might be handy to have a schema for typical implementations of various objects when starting a project, however actual implementations would be specific, requiring specific behaviours and validation requirements. This is probably why ORM or Business Object framework generation tools require a input schema to create the classes.

If a standard class framework existed, that was open-source, you would find that this schema would be massive and continually growing, this would make it difficult to keep an application updated. Each class and property of that class would require a lot of documentation with ways they could be used etc, but this could be subjective. A schema where one could select what they want and how it should be validated, to be used in an ORM / Business Object generation framework might be good idea and am sure they dont currently exist.

You could have a look at specific existing open-source projects with similar funtionality and use that for inspiration?

Mark Redman