I am looking into using the Model Validations with Breeze and I see that it does work when adding for example [Required] but the error message seems to be coming from Breeze itself, I was expecting it to pull the message directly from the Model but it's not the case. I have to build my next project with resources translation (English, French, Spanish) and I would rather have the Breeze Controller to somehow get the error message directly. As an example, in my previous project I had a model with this:
[Display(ResourceType = typeof(Resources.Validations), Name = "SiteName")]
[Required(ErrorMessageResourceType = typeof(Resources.Validations), ErrorMessageResourceName = "Required")]
public string siteName { get; set; }
which the 1st annotation Display will change the name of my input, I'll deal with that one in Angular so we can skip that one, but I would like to have the 2nd annotation Required(ErrorMessageResourceType = ...)], I would rather have Breeze to take it by itself... Having more explanation, in my resource file, I made my translation Required translation in English as this The {0} field is required. and the actual error message that I see inside Breeze is '%displayName%' is required. and so right away I can see it is not pulling anything from the Model neither the resource file and is rather a built-in Breeze error message. I found some information from this Breeze Server-side validation page, it does talk about custom validator but I thought this should actually be built-in, wouldn't it? Would there be a way to have them populated automatically? Oh and to provide some information about my own project, I use Breeze with the WebApi Controller in ASP MVC5 and also use EF6 with Breeze.ContextProvider.EF6. Does Breeze take all the Models data annotation possible from Models or does it implemented a limited set? From this breeze page Add a Breeze validator, I see a couple of them but I'm not sure if it's just client side.
I also found this question/answer Translate breeze validation messages, but that seems to be client side, again I would rather have Breeze to automatically get my translation from the resource provided in my Model.
If you provide an answer, could you please include code sample, I'm always more visual... Thanks :)