Dynamic Data - Validation in LLBLGEN entities

Posts   
 
    
Posts: 254
Joined: 16-Nov-2006
# Posted on: 16-Sep-2008 21:27:12   

I read this article in relation to the validation section

"Custom Validation Of LINQ To SQL Class Properties"

http://davidhayden.com/blog/dave/archive/2007/12/30/ASPNETDynamicDataWebsitesCustomizingPagesValidation.aspx

In here David mentions using attributes on the model class however for an LLBLGEN entity, would this be simply the partial class generated? Would you also advise adding the validation in this way?

As you can use validator classes for LLBLGEN which are separate to the entity can you not simply decorate those validator classes in some way with these attributes, or alternatively can LLBLGEN through it's dynamic data provider some how query validation and use this in the dynamic data framework which calls the model code.

Also from MSDN library documentation validation is shown here on a partial class

http://msdn.microsoft.com/en-us/library/cc668224.aspx

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 17-Sep-2008 16:25:40   

Dynamic Data requires some 'metadata' classes which are effectively simply empty classes to be decorated with attributes. So it doesn't really matter on which classes the attributes are located, as long as the dynamic data runtime can find the meta-data classes in the assemblies referenced.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 254
Joined: 16-Nov-2006
# Posted on: 18-Sep-2008 21:14:41   

Thanks Frans,

However the meta data you decorate to classes would duplicate the validation which exists in your LLBLGEN validator classes. Isn't there a way to leverage your existing LLBLGEN validation logic per field and per entity so it can reused within the dynamic data framework?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 19-Sep-2008 10:59:14   

No... the dynamic data stuff needs the special attributes... You could of course try to leverage the same attributes in your validator classes through reflection as well...

Frans Bouma | Lead developer LLBLGen Pro
Posts: 254
Joined: 16-Nov-2006
# Posted on: 19-Sep-2008 20:03:57   

Thanks Frans, yet I'm thinking something like this must be possible. There must be a way to perhaps write a plug in class which would be a proxy to the LLBLGEN framework validator classes and provide an interface to dynamic data to query this information.

quentinjs avatar
quentinjs
User
Posts: 110
Joined: 09-Oct-2009
# Posted on: 27-Oct-2009 16:18:55   

Time to revive and old thread I guess... over the past 3 years has anyone moved forward with the Dynamic Data concept in LLBL ?

The nice thing about the Dynamic Data approach is that all this data can be used for multiple purposes and is easily managed and maintained. I can use the Required attribute both in the validation as well as use it for the views. I can add a proparty to ignore a field (which is great as LLBL add many extra properties that are not data related). I can then use this same data for validation and for displaying the error messages, or for the Field Names to display.

This is of course for the cases of the simple field validations. Now using the class approach in LLLBL it is hard to manage the validations, not possible to surface these attributes for use in display capacity.

How do you in LLBL do: 1. Change the field Name to display as a title? 2. Define which are fields to display / not display on the form 3. Range Check & validations - this would be in the class validation structure. 4. Surface Error Messages - raising exceptions. 5. Define fields that are required (indicate this in the form)

Asside: Is this something in LLBL 3.0 ?

Dynamic Data seems to be a standard that is being used within many other systems within dot-net; so it would make life easy if we could leverage these systems where possible as well with LLBL.

Thoughts?

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 28-Oct-2009 10:55:22   

Please start your own thread.

Forum guidelines: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7725

quentinjs avatar
quentinjs
User
Posts: 110
Joined: 09-Oct-2009
# Posted on: 28-Oct-2009 15:40:38   

I did, I was sent here.