I like the Validation Application Block from the Enterprise Library :-)
Now i would like to use the DataAnnotations in Winforms, as we use asp.net Dynamic Data as well. So that we have common technologies over the whole company.
And also the Data Annotations should be easier to use.
How can I do something similiar in Winforms like Steph...
I have a WCF service that has a [DataContract] class defined in it. Each of the properties has the [DataMember] attribute and I have added a couple of Data Annotation attributes [Required] and [StringLength] to a couple of the properties.
I then consume this service in an asp.net MVC application as a service reference. When I get a list...
I'm just getting started on a new MVC project, and like a good boy I am trying to defer going to the DB for as long as possible. Here's the scoop:
I'm planning on using the ComponentModel.DataAnnotations decorations.
I'm also planning on using LinqToSql
Is is possible to write a unit test against the DataAnnotations metadata classes?...
I would like to intercept the "<" character in the form field by a regex validator. I will describe the problem in 3 steps:
Step 1: When I try to submit a form with a field containing the "<" character, I get the "Potentially dangerous request..." - as expected in ASP.NET.
Step 2: To avoid ASP.NET's RequestValidation, I decorate my Upd...
I've decided to use Entity Framework for O/R Mapping, and DataAnnotations for validation in my project, and I have now encountered an odd problem when trying to implement this.
This is what I've done:
I have the following entity type
Contact
*******
Int32 Id (not null, Entity Key)
Name Name (not null)
Address Address (not null)
Strin...
For example I store information about display column in database and I don't want to use DisplayColumnAttribute for define this. What can I do to create DataAnnotations info in runtime?
...
Hi
I have a Subsonic3 Active Record generated partial User class which I've extended on with some methods in a separate partial class.
I would like to know if it is possible to add Data Annotations to the member properties on one partial class where it's declared on the other Subsonic Generated one I tried this.
public partial class U...
I'm trying to setup xVal with an ASP.NET MVC 2 Preview 1 project. I'm basically following the example at http://blog.codeville.net/2009/01/10/xval-a-validation-framework-for-aspnet-mvc/ to the letter (server-side only, so far).
I have annotated a BlogPost entity, and here is the Post action:
[HttpPost]
public ActionResult Index(BlogPo...
I am following this post.
Server side validations work as expected. But the clientside validators are only getting generated for the ID field.
My Linq2Sql Entity Class has two properties ID & CategoryName and below is my Metadata class
[MetadataType(typeof(BookCategoryMetadata))]
public partial class BookCategory{}
public class BookC...
I have a custom viewmodel inside which I have two fields and one linq2sql entity .. all fields have Validation Attributes attached. Even if all fields are invalid only the fields in the linq2sql class are visually indicated for error and fields in the viewmodel are displayed normally. But the error messages are displayed for all invalid ...
What does the castle validators offer me over standard data annotations?
I am a first-time user of xVal, data annotations and castle validators so there will be a learning curve regardless of which I decide. Is it worth it to just start using casle validators (I'm assuming they will be more robust)
...
I have a complete validation on an obeject and am trying to figure out the best way to handle it.
Given the following class:
public class LetterResponse {
public Guid Id {get;set;}
public bool SendBlankCart {get;set;}
public string ToName {get;set;}
public string ToAddress {get;set;}
}
I want to use a dataannotation and xval in o...
I have certain panels on my page that are hidden under certain circumstances.
For instance I might have a 'billing address' and 'shipping address' and I dont want to validate 'shipping address' if a 'ShippingSameAsBilling' checkbox is checked.
I am trying to use the new DataAnnotations capabilities of ASP.NET MVC 2 (preview 1) to achie...
I have a customer class which has both PhoneNumber and Email properties. Using DataAnnotations I can decorate the properties with DataType validation attributes, but I cannot see what that is getting me.
For example:
[DataType(DataType.PhoneNumber)]
public string PhoneNumber {get; set;}
I have a unit test that assigned "1515999A"...
I'm using xVal in my ASP.NET MVC application, which is great in general. Following Steve Sanderson's blog post, I created a DataAnnotationsValidationRunner to do server-side validation of attributed objects. This works great for a simple class. e.g. Person:
public static class DataAnnotationsValidationRunner
{
public static IEnume...
I am using custom view model classes as DTO objects to hold data for display on my View pages. I have applied validation via the DataAnnotations library to perform server side validation on the properties of these classes. Here is a simple example:
[DisplayName("Customer Account Id")]
[Required(ErrorMessage = "* Account Number is requir...
I have the following code in a partial class and I'm using LINQ to SQL:
[Bind(Include = "OrderId,OrderTypeId,CustomerName,Price")]
[MetadataType(typeof(OrderMetadata))]
public partial class Order
{
}
public class OrderMetadata
{
[DisplayName("Customer Name")]
[Required]
public object CustomerName { get; set; }
}
I'm tr...
Hi
Is it possible to use [Range] annotation for dates?
something like
[Range(typeof(DateTime), DateTime.MinValue.ToString(), DateTime.Today.ToString())]
Thanks
Davy
...
Hi I have the following cod throughout my app but with just two fields it's not working.
[Required]
public string DevelopmentPM { get; set; }
The following test runs and passes:
[TestMethod]
public void SiteConstruction_MODEL_DevelopmentPM_Is_Required()
{
//arrange
var propertyInfo = typeof(SiteCon...
I have written a custom credit card validation attribute that checks CardNumber property is valid for a particular card type (another property in the same class)
[CardValidationBinCheck(this.CardType,
ErrorMessage = "CreditCardNumberDoesNotMatchCardType")]
public string CardNumber
{
...
}
This won't compile a...