In MVC 5 with EF 6.1 for migration i did below steps to update my database:
- in PMC Enable-Migrations -ContextTypeName [SiteDbContext] ( i have two DbContext in my project)
- Set AutomaticMigrationsEnabled to true in Configuration file in migration folder.
-
Modifying my class from
[Required(ErrorMessageResourceName = "ContextFaRequired", ErrorMessageResourceType = typeof(Resources.Resources))] [MaxLength(10000, ErrorMessageResourceName = "ContextFaLong", ErrorMessageResourceType = typeof(Resources.Resources))] [Display(Name = "ContextFa", ResourceType = typeof(Resources.Resources))] [DataType(DataType.Text)] public string ContextFa { get; set; }
to
[Display(Name = "ContextFa", ResourceType = typeof(Resources.Resources))]
[DataType(DataType.Text)]
public string ContextFa { get; set; }
3.Build project
- in PMC Update-database.
update done and i can see changes applied in database, but now when i try to access modified table i get this error: "Caot resolve Collation conflict .."
