Archive for category NHibernate.Validator

NHibernate.Validator 1.0.0 alpha1 released

Finally you can download the first official drop of NHibernate.Validator. This project began as a port of Hibernate.Validator project, but later was growing up on features, and now has a quite different API, optimized to validate objects integrated with NHibernate and objects of any part of our application. NHibernate Validator allow us to validate objects configured using .Net attributes or nhv.xml files.

Download binaries, source and samples here

1 Comment

Movements on NHibernate.Contrib

The non-Core projects on NHibernate are on moving into NHibernate.Contrib. This is the list of projects that we can use and its states:

  • NHibernate.Burrow/
  • NHibernate.Caches.MemCache/
  • NHibernate.Caches.Prevalence/
  • NHibernate.Caches.SysCache/
  • NHibernate.Caches.SysCache2/
  • NHibernate.JetDriver/
  • NHibernate.Mapping.Attributes/
  • NHibernate.Shards/
  • NHibernate.Tasks/
  • NHibernate.Tool.hbm2net/
  • NHibernate.UserTypes.Oracle/
  • NHibernate.UserTypes.SqlTypes/
  • NHibernate.Validator/
  • NHibernate.Search (not moved yet)

    The new projects here are: Search, Validator, Shards and Burrow. The first two are ready to use. NHibernate Shards is on development (I’m working on it) and Burrow is on development by Fabio Maulo and Kailuo Wang.

     

    NHibernate Shards need some improvements on NHibernate-Core to make the port a little more easier (i.e. Entity-Name).

  • 3 Comments

    NHibernate Validator on Winforms

    NHibernate.Validator is a framework to validate objects, and has not restrictions about where in your code you want make the validation. Figured it might be cool make an example when use this framework at the UI, for example onto Asp.net or Winforms. For now lets do it on Winforms.

    The next form with a couple of textbox is going to be validated:

    Ok now, how this form was validated?  Easy, using NHibernate.Validator and some helper classes that you can find on Suricato.Winforms.Validation. The ViewValidator class is the encharged of bind the controls and rules. This is the configuration:

    As you can see the ErrorProvider, that will show the inconsistencies on the values, it’s passed to the ViewValidator. Practically ViewValidator bind an UI control with the belongings rules of an object’s property. The “tFirstName” TextBox belong with the property’s rule of “FirstName” on the Customer class. Then we add the event that will do the control validation.

    Could that be made in a easiest way?  Yes, with a similar schema the SmartViewValidator class do bind the objects and the event registry of an automatically manner. Look:

    SmartViewValidator do for us some automatically things. With less code you can do the same job, but we need to be a little conventional on our code.

    The controls, must have the prefix in lowercase, following with the property’s name that it’s representing. For example, if we have a control named as “txtName”, the property’s name will be “Name”; if we have “dtpDate”, then this DateTimePicker will belong to the property “Date” on some class.

    We need to remember of initialize this controls after call InitializeComponent() to avoid nullability on ErrorProvider.

    How look our class with NHibernate.Validator’s attributes ?

    So, you can put NHibernate.Validator where you need to validate some code with pre-builded rules or custom rules made by you too. With only configure 1 line of code and everything is integrated with the UI.

    Download the example of NHibernate.Validator + Winforms

    No Comments

    NHibernate Validator ready

    The port of Hibernate Validator it’s ready. You can reach it at NHibernate.Contrib trunk. For documentation you can take a look at Hibernate.Validator Documentation and for examples I think that the tests are the best example.

    [Post updated 01-march-2008]

    No Comments