Can this SpecExpress library be used for generating javascript validation code to avoid duplication ?

Feb 23, 2011 at 10:55 AM

Can this library be used for creating a validation model that then can be used for automatically validate the code at server-side with C# (in ASP.NET MVC) but that also can be used for generating javascript validation code ?

If so, then maybe someone can provide a code (link to some blog post maybe?) example that illustrates how to put the pieces together in a working example ?

For a more detailed question and explanation what I am looking for, you can also see (which is a link that might become an interesting thread to follow for other readers that are also looking for a solution to only write the rules once and not twice for different languages):

Apr 13, 2011 at 11:31 PM


Implementing rules on a web platform has been the vain of a lot of developers in that in order to give the user feed back as quick as possible, the logic has to be duplicated on both server and client side.   Or many simply enforce the logic at the client side and thus the same business logic is duplicated accross many forms that work with the same data.  Such duplication becomes the source of many maintenance headaches and can contribute to the application to becoming a big ball of mud (

So I hear your voice and long for a solution as well!  I am currently exploring options and creating prototypes of a routine that will generate jquery for a given specification that can be leveraged on the client.  There are many hurdles to it becoming a success though.  For instance the specification may contain rules that simpy must run on the server (i.e. ensure that a value of a property is valid against a list of valid values where the list is in a database, or where an expression is used as  rule parameter).  Hopefully this gives you something to look forward to.