Basically, what the title says. I have several properties that combine together to really make one logical answer, and i would like to run a server-side validation code (tha
i've done the following, using FluentValidator, if it is useful to anyone, thanks to Darin's recommendations:
Public Class tProductValidator
Inherits AbstractValidator(Of tProduct)
Public Sub New()
Const RetailWholsaleError As String = "You need to enter either a Retail Price (final price to user) or a Wholesale Price (price sold to us), but not both."
Dim CustomValidation As System.Func(Of tProduct, ValidationFailure) =
Function(x)
If (x.RetailPrice Is Nothing AndAlso x.WholesalePrice Is Nothing) OrElse (x.RetailPrice IsNot Nothing AndAlso x.WholesalePrice IsNot Nothing) Then
Return New ValidationFailure("RetailPrice", RetailWholsaleError)
End If
Return Nothing
End Function
Custom(CustomValidation)
End Sub
End Class
as usual, i was fooled into thinking MVC was a complete framework, where real world scenarios were possible. how on earth do they publish such things and not even mention its limitations i don't understand, we developers then run into issues that are a nightmare to get around or we have to rely on 3rd party stuff to do what is intrinsically MVC responsibility, and if 3rd party items weren't available - then what?
this is not the 1st serious fall back i've found in mvc 2.0 either, the list keeps growing.
sure the team keeps giving these 'cool' examples of how simple things are using imaginary non-real world examples, and when it comes to the real stuff it's like "heck we dont know or care, nor will we tell you about it, you'll just have to run into it and sort it out yourself" type deal
oh, and updating multiple parts of a view in one round trip is still not possible unless you use a js hack and cut the return html up and assign it to different div's... you can't even return multiple views or at least update multiple areas of a page natively (in one round trip), its just saddening.
Maybe when MVC reaches version 3.0 it may actually be complete, fingers crossed, as the dotnet framework wasn't realistically 'complete' until clr 3.5 & including linq/EF to SQL...