1
I Use This!
Inactive

News

Analyzed 1 day ago. based on code collected 1 day ago.
Posted over 11 years ago by JaCraig
There is indeed a bug. Apparently the default behavior for Validator.TryValidate (which is what the extension method wraps) is to only validate Required properties... Why the hell you would make that the default, I don't know. Anyway, I'm pushing up a fix now and adding your above code to the unit tests (along with a couple other checks).
Posted over 11 years ago by JaCraig
There is indeed a bug. Apparently the default behavior for Validator.TryValidate (which is what the extension method wraps) is to only validate Required properties... Why the hell you would make that the default, I don't know. Anyway, I'm pushing up a fix now and adding your above code to the unit tests (along with a couple other checks).
Posted over 11 years ago by sharethl
Found a problem on Data validation, Not sure is it my code problem? the result is Suppose to be false, but it is true here. Seems [Required] works, but [Range] not working. [TestClass] public class ValidationTest { class Dog{ ... [More] [Required()] public string Name { get; set; } [Range(0,20)] public int Age { get; set; } } [TestMethod] public void ObjectValidationTest(){ var dog = new Dog(){Age = -1,Name = "Jim"}; ICollection validationResults = new List(); var result = dog.TryValidate(validationResults); Assert.IsFalse(result); } } [Less]
Posted over 11 years ago by sharethl
Found a problem on Data validation, Not sure is it my code problem? the result is Suppose to be false, but it is true here. Seems [Required] works, but [Range] not working. [TestClass] public class ValidationTest { class Dog{ ... [More] [Required()] public string Name { get; set; } [Range(0,20)] public int Age { get; set; } } [TestMethod] public void ObjectValidationTest(){ var dog = new Dog(){Age = -1,Name = "Jim"}; ICollection<ValidationResult> validationResults = new List<ValidationResult>(); var result = dog.TryValidate(validationResults); Assert.IsFalse(result); } } [Less]
Posted over 11 years ago by sharethl
JaCraig wrote: Finally had a chance to think about the issue. Basically the remove extension method, since it is at the IEnumerable level, can't directly remove from the list and leave it in place. So it probably makes more sense to rename the ... [More] Remove extension to something like WhereNot(). It's basically a negated where clause. I just need to figure out a better name so that it's easy to find and not confusing as to the intent. I'm going to leave the 3.4.X version the same so that I don't screw up too many people's code but I'll make the change in the 4.0 version. Nice to hear that. Thanks you. [Less]
Posted over 11 years ago by sharethl
JaCraig wrote: Finally had a chance to think about the issue. Basically the remove extension method, since it is at the IEnumerable<T> level, can't directly remove from the list and leave it in place. So it probably makes more sense to rename ... [More] the Remove extension to something like WhereNot(). It's basically a negated where clause. I just need to figure out a better name so that it's easy to find and not confusing as to the intent. I'm going to leave the 3.4.X version the same so that I don't screw up too many people's code but I'll make the change in the 4.0 version. Nice to hear that. Thanks you. [Less]
Posted over 11 years ago by JaCraig
Finally had a chance to think about the issue. Basically the remove extension method, since it is at the IEnumerable level, can't directly remove from the list and leave it in place. So it probably makes more sense to rename the Remove extension to ... [More] something like WhereNot(). It's basically a negated where clause. I just need to figure out a better name so that it's easy to find and not confusing as to the intent. I'm going to leave the 3.4.X version the same so that I don't screw up too many people's code but I'll make the change in the 4.0 version. [Less]
Posted over 11 years ago by JaCraig
Finally had a chance to think about the issue. Basically the remove extension method, since it is at the IEnumerable<T> level, can't directly remove from the list and leave it in place. So it probably makes more sense to rename the Remove ... [More] extension to something like WhereNot(). It's basically a negated where clause. I just need to figure out a better name so that it's easy to find and not confusing as to the intent. I'm going to leave the 3.4.X version the same so that I don't screw up too many people's code but I'll make the change in the 4.0 version. [Less]
Posted over 11 years ago by JaCraig
The remove function is a generic extension method on IEnumerable<T>. No way to really do what you are suggesting on that level.
Posted over 11 years ago by JaCraig
The remove function is a generic extension method on IEnumerable. No way to really do what you are suggesting on that level.