0

I have this property on one of my models:

[Required]
[AllowHtml]
public string Content { get; set; }

In my SQL database this gives me a data type of nvarchar(MAX).

I want it to have a data type of xml.

What data annotation do I need to use?

I'm recreating some code from an old code first application and all I have is the database so it seems this is possible but I can't find any information on how.

Jon
  • 3,173
  • 3
  • 39
  • 66
  • Have a look at http://stackoverflow.com/questions/7190669/xml-data-type-in-ef-4-1-code-first and http://stackoverflow.com/questions/12631290/xml-columns-in-a-code-first-application – andyp May 28 '14 at 22:26

1 Answers1

2

This worked for me:

[Required]
[AllowHtml]
[Column(TypeName = "xml")]
public string Content { get; set; }
Jon
  • 3,173
  • 3
  • 39
  • 66