Add support for string based properties decorated with the RangeAttribute
See original GitHub issueConsider the following:
public class MyModel
{
[Required]
[Range(1, 65535)]
public string Port { get; set; }
}
var fixture = new Fixture();
var model = fixture.Create<MyModel>();
In 3.51.0 the first call the Create() worked, however subsequent calls threw, now in 4.0.0-rc1 (the version I am using), the first call throws ObjectCreationException
whereas the attribute itself offers support for the use case.
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
c# - Allow RangeAttribute to apply to properties in sub- ...
What I want to be able to do is decorate the Item and Item2 values on the MyViewModel with different range attributes. However...
Read more >RangeAttribute Class (System.ComponentModel. ...
Initializes a new instance of the RangeAttribute class by using the specified minimum and maximum values and the specific type. Properties ...
Read more >Range Attribute in ASP.NET MVC Application
In this article, I am going to discuss Range Attribute in ASP. ... and 25 as the maximum length then we can decorate...
Read more >(C#) Is it possible to define range attributes with instance ...
Hey all, I was wondering if it would be possible for me to accomplish limiting a field's range in the editor to below...
Read more >Range Attribute, Custom Attribute & Custom Validation
This attribute can set a range of valid value for each property with different property type. Also, Range attribute is in System.ComponentModel.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To be honest, it’s a convention I am used to from the ASP arena and I don’t know if it’s an abuse of the facility or intended. I will check out the docs and if not, the reference source for logic that indicates it’s valid and expected and not simply a fragile coincidence.
@jcasale Feel free to use the NumericRangedRequestRelay or EnumRangedRequestRelay as a sample of such customization.
This API will be available since our next release that should happen in the nearby future.
Closing this one as no further action is required so far. Feel free to ask more questions if you have 😉