DataAnnotations in Mvc 6 and Entityframework 7-beta 4

entity-framework-core

Question

How to use Dataannotation attributes in mvc 6 with entityframework 7 beta4?

I am not able to use dataannotation attributes such as required, Key,StringLength,MaxLength etc in data model for entityframework code first migration.

I added stringLength(45) in model and getting as nvarchar(max) in table instead of nvarchar(45).

Popular Answer

In Progress

The following features are currently being implemented. Some scenarios may work, but there are significant limitations as the work is incomplete.

Modeling

Data annotations are attributes that can be added to your entity classes/properties and will influence the EF model (i.e. adding [Required] will let EF know that a property is required).

Source



Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why