tagged [annotations]

Name attribute in @Entity and @Table

Name attribute in @Entity and @Table I have a doubt, because name attribute is there in both @Entity and @Table For example, I'm allowed to have same value for name attribute and I can have different ...

What does the @Valid annotation indicate in Spring?

What does the @Valid annotation indicate in Spring? In the following example, the `ScriptFile` parameter is marked with an `@Valid` annotation. What does `@Valid` annotation do? ``` @RequestMapping(va...

DataType vs UiHint

DataType vs UiHint I have been using mvc2 for a while now, and when i need to set the template i use the DataType Attribute > I see others using UiHint to achieve the same results > What is the differ...

Is it possible to use DataAnnotations with Interfaces?

Is it possible to use DataAnnotations with Interfaces? I want to use DataAnnotations to validate classes that implements some interfaces, and so I'm adding validation attributes to the interface, like...

16 Jul at 14:43

Difference between @size(max = value ) and @min(value) and @max(value)

Difference between @size(max = value ) and @min(value) and @max(value) I want to do some domain validation. In my object I have one integer. Now my question is: if I write and If it's an integer which...

28 Jul at 20:29

What is the proper data annotation to format my decimal property?

What is the proper data annotation to format my decimal property? I have a POCO with a decimal property called SizeUS. I would like to use data annotations to format the display of the decimal in a vi...

30 Dec at 22:57

Does Spring @Transactional attribute work on a private method?

Does Spring @Transactional attribute work on a private method? If I have a [@Transactional](http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/transaction/annotation/Transactiona...

9 Dec at 08:38

MVC Validation Lower/Higher than other value

MVC Validation Lower/Higher than other value How is the best way to validate a model in MVC.Net where I want to accept a minimum/maximum. Not individual min/max values for a field. But separate fields...

Get error message when using custom validation attribute

Get error message when using custom validation attribute I'm using the CustomValidationAttribute like this And my validator contains this code > ``` public class MyValidator { public static Validati...

Java Annotation C# equivalent

Java Annotation C# equivalent > [What are the similarities and differences between Java Annotations and C# Attributes?](https://stackoverflow.com/questions/553857/what-are-the-similarities-and-differ...

23 May at 12:2

Scanning Java annotations at runtime

Scanning Java annotations at runtime How do I search the whole classpath for an annotated class? I'm doing a library and I want to allow the users to annotate their classes, so when the Web applicatio...

26 Jul at 15:43

how to put DisplayName on ErrorMessage format

how to put DisplayName on ErrorMessage format I have something like this: I want to have the following output: - - , but when I try to validate it manually, like this

24 Aug at 15:11

Mark a field "Read Only" with Data Annotations

Mark a field "Read Only" with Data Annotations I am trying to make the `ID` field read only. It is an Identity field in the DB so the user will not be setting it. However they would like to see it. Wh...

9 May at 05:31

How can I validate nested model?

How can I validate nested model? I trying to validate the nested Model but the data annotation attribute is not executing when the Nested Model Instance create. ``` public ActionResult GetT

1 Oct at 16:16

C# - Using Custom Annotations?

C# - Using Custom Annotations? I created this Annotation class This example might not make sense because It'll always throw an exception but I'm still using it as I am just trying to explain what my q...

19 Aug at 11:6

What are the similarities and differences between Java Annotations and C# Attributes?

What are the similarities and differences between Java Annotations and C# Attributes? I have a Java library I'm considering porting to C#. The Java library makes extensive use of annotations (at both ...

ASP.NET MVC: Custom Validation by DataAnnotation

ASP.NET MVC: Custom Validation by DataAnnotation I have a Model with 4 properties which are of type string. I know you can validate the length of a single property by using the StringLength annotation...

Is it possible NOT to use data annotations attributes ServiceStack OrmLite?

Is it possible NOT to use data annotations attributes ServiceStack OrmLite? I'm trying to explore the functionality of ServiceStack.OrmLite and can't understand if it possible to use bootstrap class f...

How to use DataAnnotations ErrorMessageResourceName with custom Resource Solution

How to use DataAnnotations ErrorMessageResourceName with custom Resource Solution I'm building a MVC web application with C#. Since the site will be multilingual, I've implemented my own ResourceManag...

Get DisplayAttribute attribute from PropertyInfo

Get DisplayAttribute attribute from PropertyInfo I'm trying to map the model into a list of `{ PropertyName, DisplayName }` pairs, but I've got stuck. ``` var properties = typeof(SomeModel) .Get...

Why can't I reference System.ComponentModel.DataAnnotations?

Why can't I reference System.ComponentModel.DataAnnotations? I'm trying to use DataAnnotations in my WPF project to specify a maximum length of strings, with the following: However, I get the error > ...

16 Apr at 12:50

Passing/exposing T on a ServiceStack request filter

Passing/exposing T on a ServiceStack request filter I've got a request attribute that I'm decorating some services, but I need to pass a generic type into it because of some logic happening inside of ...

AnnotationConfigApplicationContext and parent context

AnnotationConfigApplicationContext and parent context I'm facing an issue trying to define a context hierarchy using `AnnotationConfigApplicationContext`. The problem is when defining a module context...

6 Dec at 09:6

What parameters does the stringlength attribute errormessage take?

What parameters does the stringlength attribute errormessage take? In the MVC4 template one of the data annotation attributes used is stringlength. For example: What parameters {0}, {1}, {2} (more?) a...

16 Nov at 22:37

How to retrieve Data Annotations from code? (programmatically)

How to retrieve Data Annotations from code? (programmatically) I'm using `System.ComponentModel.DataAnnotations` to provide validation for my Entity Framework 4.1 project. For example: ``` public clas...