Note that there are some explanatory texts on larger screens.

plurals
  1. POIs it possible to extend Breeze Metadata received from the server?
    primarykey
    data
    text
    <p>Wondering if anyone knows of any way to extend or configure Breeze so that the server returns additional info in the entity metadata? I'd like to use this additional data to assist with validation. </p> <p>Assume I have an entity model like so with some Data Annotations applied:</p> <pre><code>public class Person { [RegularExpression(@"^$|^http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?", ErrorMessage="The Website address does not appear to be valid.")] public string Website { get; set; } [Required(ErrorMessage="The Name field is required."), MaxLength(150, ErrorMessage = "The Name field cannot exceed 150 characters."), MinLength(5, ErrorMessage = "The Name field must be at least 5 characters.")] public string Name { get; set; } //... } </code></pre> <p>Right now, Breeze only hooks up a MaxLength and Required Validator based on the metadata it receives since this is all it supports out of the box. If Breeze could include in the metadata the info described in the Data Annotation Attributes on the server entity, I'm thinking it would then be possible for Breeze to automatically add additional stock validators to the client EntityType (e.g. for RegEx, Range, MinLength, etc... ). This would cover the majority of basic validation use cases. Or, it could also allow developers to inspect the metadata and pull out useful info like the regEx string which we could use to hook up our own custom RegEx validator.</p> <p>Also, is there any way to have Breeze include the value of the ErrorMessage validation attribute property in the metadata and then have the breeze client use that instead of the default required and maxLength messageTemplates? This would mean you would only have to define the error message in one place on the server and wouldn't have to customize it for each entity.</p> <p>I'm trying to avoid having to create and register a bunch of custom validators on the client for what seems like basic validations that could be handled by Breeze automatically.</p> <p>Thanks, Richard</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload