c# Programming Glossary: isvalid
Multiple Aggregates / Repositories in one Transaction http://stackoverflow.com/questions/11445657/multiple-aggregates-repositories-in-one-transaction coupons foreach GiftCoupon coupon in coupons if coupon.IsValid throw new Exception Coupon is no longer valid coupon.UseForPaymentOnOrder.. GiftCoupon coupon base paymentId paymentDate if coupon.IsValid throw new Exception Coupon is no longer valid _couponId coupon.GiftCouponId.. DateTime IssuedDate get return _issuedDate public bool IsValid get return _usedDate default DateTime public void UseForPaymentOnOrder..
Writing a CompareTo DataAnnotation Attribute http://stackoverflow.com/questions/1607832/writing-a-compareto-dataannotation-attribute operation _Comparision comparison public override bool IsValid object value if value is IComparable return false switch _Operation.. obj null as IComparable public override bool IsValid object value var comp1 GetComparablePropertyValue value _ComparisionPropertyName1..
ASP.NET MVC: Custom Validation by Data Annonation http://stackoverflow.com/questions/16100300/asp-net-mvc-custom-validation-by-data-annonation get private set protected override ValidationResult IsValid object value ValidationContext validationContext var properties..
C#: cast to generic interface with base type http://stackoverflow.com/questions/1749886/c-cast-to-generic-interface-with-base-type type Here's the code public interface IValidator T bool IsValid T obj public class OrderValidator IValidator Order ... public.. void myFunc IValidator BaseEntity myValidator myValidator.IsValid new BaseEntity This code would compile correctly. Nevertheless.. you would get a run time exception because OrderValidator.IsValid expects an Order not a BaseEntity. Type safety would no longer..
General type conversion without risking Exceptions http://stackoverflow.com/questions/2111280/general-type-conversion-without-risking-exceptions and doesnt consider the actual data to be converted. The IsValid method is also useless. Any ideas EDIT I cannot use AS and IS...
Is the DataTypeAttribute validation working in MVC2? http://stackoverflow.com/questions/2391423/is-the-datatypeattribute-validation-working-in-mvc2 doesn't influence validation by default. This is IsValid method of this attribute from reflector public override bool.. of this attribute from reflector public override bool IsValid object value return true This is example of custom DataTypeAttribute.. base DataType.EmailAddress public override bool IsValid object value string str Convert.ToString value CultureInfo.CurrentCulture..
.NET MVC Custom Date Validator http://stackoverflow.com/questions/3614076/net-mvc-custom-date-validator ValidationAttribute public override bool IsValid object value DateTime dateStart DateTime value Meeting must.. string DateStartProperty get set public override bool IsValid object value Get Value of the DateStart property string dateStartString..
ASP.Net MVC 2 Controller's TryValidate doesn't validate the List<> items within the model http://stackoverflow.com/questions/4465432/asp-net-mvc-2-controllers-tryvalidate-doesnt-validate-the-list-items-within ValidationAttribute public override bool IsValid object value IEnumerable enumerable value as IEnumerable If.. property.GetValue item null if validationAttribute.IsValid propertyValue Return false if one value is found to be invalid...
Validation: How to inject A Model State wrapper with Ninject? http://stackoverflow.com/questions/4776396/validation-how-to-inject-a-model-state-wrapper-with-ninject void AddError string key string errorMessage bool IsValid get wrapper using System.Web.Mvc namespace MvcApplication1.Models.. _modelState.AddModelError key errorMessage public bool IsValid get return _modelState.IsValid #endregion controller private.. errorMessage public bool IsValid get return _modelState.IsValid #endregion controller private IProductService _service public..
How does DataAnnotations really work in MVC? http://stackoverflow.com/questions/5154231/how-does-dataannotations-really-work-in-mvc the ValidationAttribute interface and override the IsValid or Create a Self Validate Model use the model IValidatebleObject.. name OtherPropertyName public override ValidateionResult IsValid object value ValidationContext validationContext var otherPropertyInfo..
c# regex email validation http://stackoverflow.com/questions/5342375/c-sharp-regex-email-validation email addresses using the MailAddress class public bool IsValid string emailaddress try MailAddress m new MailAddress emailaddress..
Where to put global rules validation in DDD http://stackoverflow.com/questions/5818898/where-to-put-global-rules-validation-in-ddd and more ... better use DI to fill this list public bool IsValid User entity return BrokenRules entity .Count 0 public IEnumerable.. the interfaces public interface IValidator T bool IsValid T entity IEnumerable string BrokenRules T entity public interface..
MVC Form Validation on Multiple Fields http://stackoverflow.com/questions/6075339/mvc-form-validation-on-multiple-fields _fields fields protected override ValidationResult IsValid object value ValidationContext validationContext foreach string..
In C#, sign an xml with a x.509 certificate and check the signature http://stackoverflow.com/questions/1195728/in-c-sign-an-xml-with-a-x-509-certificate-and-check-the-signature csp.FromXmlString PublicKeyXml bool isValid VerifyXml xmlDoc rsa2 And the VerifyXml calls CheckSignature..
Does Java have “properties” that work the same way properties work in C# (see the body of my text)? http://stackoverflow.com/questions/2701077/does-java-have-properties-that-work-the-same-way-properties-work-in-c-sharp-s newInt ... public int x get return this.x set this.x isValid value private static int isValid int value ... This definition.. return this.x set this.x isValid value private static int isValid int value ... This definition in the class allows the user to..
Validate a username and password against Active Directory? http://stackoverflow.com/questions/290548/validate-a-username-and-password-against-active-directory YOURDOMAIN validate the credentials bool isValid pc.ValidateCredentials myuser mypassword It's simple it's reliable..
How do I use IValidatableObject? http://stackoverflow.com/questions/3400542/how-do-i-use-ivalidatableobject false var results new List ValidationResult bool isValid Validator.TryValidateObject toValidate new ValidationContext..
How can I use the Data Validation Attributes in C# in a non-ASP.net context? http://stackoverflow.com/questions/3782678/how-can-i-use-the-data-validation-attributes-in-c-sharp-in-a-non-asp-net-context myObject null null MemberName UserName var isValid Validator.TryValidateProperty value vc results get all the errors..
Xml validation using XSD schema http://stackoverflow.com/questions/572853/xml-validation-using-xsd-schema new StringReader document.InnerXml settings while rdr.Read isValid true The ValidationEventHandler also tells me what the errors..
How can I sign a file using RSA and SHA256 with .NET? http://stackoverflow.com/questions/7444586/how-can-i-sign-a-file-using-rsa-and-sha256-with-net signed aescsp.SignData File.ReadAllBytes file SHA256 bool isValid aescsp.VerifyData File.ReadAllBytes file SHA256 signed The problem..
Authentication Service using WCF http://stackoverflow.com/questions/9584198/authentication-service-using-wcf bool ValidateUser string username string password bool isValid true my logic to validate the user name and password return.. my logic to validate the user name and password return isValid other implementations of Abstract Methods from MembershipProvider..
|