Client Side Validation & POCO's

Posts   
 
    
Posts: 72
Joined: 11-Aug-2006
# Posted on: 05-Sep-2011 23:49:46   

Hi There

Trying to look at easiest & most scalable architecture. We have looked at POCO objects with the EF4 framework - it looks like you can decorate the fields in the classes with attributes that automatically provide client side validation in MVC ( see ) .

With 3.1 - is there anything in the LLBLGen Framework that does this sort of thing? Or any ideas around this area?

thanks sunglasses

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 06-Sep-2011 02:57:27   

Yes, you can use the Attribute system at Project/Entity/Field level, and you can define macros on them. In the next version comes a more intelligent macro system that allows you to do more things.

You can also generate your own buddy classes to add MetadataAnnotations. See this: http://llblgen.com/tinyforum/Messages.aspx?ThreadID=18673&StartAtMessage=0&#104946

Here is a MVC2 sample app if you want to take a look: http://llblgen.com/tinyforum/Messages.aspx?ThreadID=19731&StartAtMessage=0&#111280

Other related threads: http://llblgen.com/tinyforum/Messages.aspx?ThreadID=18323

David Elizondo | LLBLGen Support Team
Posts: 72
Joined: 11-Aug-2006
# Posted on: 06-Sep-2011 03:22:34   

Please excuse my ignorance, It seems at a quick glance that this is an attribute system for adding these attributes in to the .Net Code - which would be suitable to add to POCO generated objects.

If I didn't want to use POCO objects and wanted to use the LLBLGen Pro framework - do the LLBL Pro Framework generated classes easily handle attribute validation?

( I'm not sure if you are telling me to use POCO and generate attributes - or use the LLBLGen Framework )

thanks :-)

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 06-Sep-2011 11:10:27   

Please excuse my ignorance

Ok, if you'll execuse mine too simple_smile

LLBLGen Pro framework is about handling Low Level Business Objects and Data Access activities. So for entityFields there exists built-in validations. I suggest you check this: Validations.

Attribute validations adds to the above the ability to validate at client side. Like what's explained here: http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx

So LLBLGen Pro entities/framework doesn't need to handle Attribute validation, as it's already has it's built-in validations, and the Validation Frameowrk, where you can add your own validation classes to be used when validating entities and fields.

Posts: 72
Joined: 11-Aug-2006
# Posted on: 07-Sep-2011 01:53:57   

So - to me , Client side validation attributes with LLBLGen Pro sounds like what I want. What is the best / easiest way to implement that?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 07-Sep-2011 09:24:45   

LLBLGen Pro has nothing to do with Client side validation, except that it gives you the ability to decorate entities and fields with attributes at design time.

Other than that it's you and your UI Framework simple_smile

Posts: 72
Joined: 11-Aug-2006
# Posted on: 08-Sep-2011 06:12:44   

Yes - that is what I am asking. Given this post http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx - the MVC framework looks at the attributes of the classes ( or data annotations ) .

Is there a way to generate default data annotations on a project or entity level easily to achieve the same?

thanks!

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 08-Sep-2011 10:46:39   

Please check the Attribute System link that David (daelmo) has provided.