Questions tagged as 'dataannotations'

3
answers

How to validate CPF with DataAnnotation on Client and Server?

I need to validate CPF with Data Annotation , and check for duplicity.     
asked by 02.03.2014 / 16:40
2
answers

Relationship N for N and One for N with CodeFirst Data Annotations

How can I make the N to N and N to N relationships using Data Annotations? For example: A sales move has a user, and a user can have multiple moves. This same sales movement has several products, and each product can be in several movem...
asked by 21.06.2014 / 03:35
3
answers

Is there Data Annotation that avoids duplication of data in the Bank?

How do I prevent data being duplicated in the database using Data Annotation or would it be through another validation?     
asked by 10.11.2016 / 16:18
2
answers

What is the cleanest and clearest way to validate entities using the Entity Framework

I'm using the Entity Framework for data manipulation. The project is divided into 2, one containing the domain entities and the other Fluent Api mappings). I need a clean and clear way to validate entities without polluting entities with Dat...
asked by 02.02.2017 / 00:00
3
answers

DataAnotation Attribute for Currency

I would like to format with DataAnnotation currency but default en in the model: [Column("cur_mensalidade")] [DataType(DataType.Currency)] [DisplayFormat(DataFormatString = "{0:C0}")] public decimal? Mensalidade { get; set; } but does no...
asked by 03.05.2016 / 14:34
3
answers

What is the difference between Data Annotations and Fluent API?

What's the difference between Data Annotations and Fluent API? Are there any restrictions between one or the other? Improve performance or are they just two ways to do the same?     
asked by 28.11.2016 / 20:07
1
answer

DataAnnotation validating property with Javascript plugin. ASP.NET MVC

I need to validate a field in my model that has a text editor in Javascript . So far so good, because the problem only occurs in the registry that I do not get in the Action parameter "Create" an object, but a FormCollection . In the...
asked by 16.07.2014 / 05:41
2
answers

What is the corresponding variable type of timestamp (SQL Server) in C #?

I have a field in the database (SeqAlteracao) of type timestamp and I need to map it to the C # (Entity Framework). What is the corresponding type in C # for this type in the bank? public **Tipo** SeqAlteracao { get; set; }     
asked by 21.11.2016 / 21:00
1
answer

Validate data from an object with DataAnnotations C # Winforms

Good afternoon, I have the following Entity class marked by Data Annotations: public class Cargo { [Key] [Display(Name ="Código")] public int Codigo { get; set; } [Required(AllowEmptyStrings =false, ErrorMessage = "A descrição...
asked by 29.10.2016 / 16:58
1
answer

Entity Framework: Data Model with column with the largest possible number of characters

I'm creating tables with Entity Framework , and I'm using Data Annotation to determine the amount of characters, I wanted to know what the largest size supported for typing text and if the correct type would be string same?...
asked by 18.01.2017 / 22:48