public ActionResult checkSimpleSentence(UnsafeValue testValue) { mdlTestResult ret = new mdlTestResult(); ret.testResult = testValue.Validate<valSimpleComment>().isValid; // note: this validator is in the Unsafe.Data.Common.Validators namespace return Json(ret); }
public ActionResult checkNegInt(UnsafeValue testValue) { mdlTestResult ret = new mdlTestResult(); ret.testResult = testValue.Validate<valNegInteger>().isValid; // note: this is a custom validator in this project's bizObjects namespace return Json(ret); }
public static unsafe T ClearFlags <T>(T value, T flags) where T : unmanaged { if (sizeof(T) == 1) { return(UnsafeValue.As <byte, T>((byte)(Unsafe.As <T, byte>(ref value) & ~Unsafe.As <T, byte>(ref flags)))); } else if (sizeof(T) == 2) { return(UnsafeValue.As <short, T>((short)(Unsafe.As <T, short>(ref value) & ~Unsafe.As <T, short>(ref flags)))); } else if (sizeof(T) == 4) { return(UnsafeValue.As <int, T>(Unsafe.As <T, int>(ref value) & ~Unsafe.As <T, int>(ref flags))); } else if (sizeof(T) == 8) { return(UnsafeValue.As <long, T>(Unsafe.As <T, long>(ref value) & ~Unsafe.As <T, long>(ref flags))); } throw new NotSupportedException(); }
public ActionResult checkDangerousID(UnsafeValue testValue) { mdlTestResult ret = new mdlTestResult(); ret.testResult = testValue.Validate<valID>().isValid; // note: this validator is in the Unsafe.Data.Common.Validators namespace return Json(ret); }