Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework 4.3 beta [Column(TypeName)] issue, cannot create columns of type xml

I understand this is a beta (just checked the new version of EF 4.3 and it does the same thing) release and some functionality may be missing, but i haven`t seen anything to explain why...

[Column(TypeName = "xml")]
public string SomeProperty { get; set; }

... no longer creates a column of type xml when using EF 4.3 (column is created as nvarchar(max)) , I have tried EF 4.2 and that creates the column just fine. Just for reference i am connecting to sql server 2008r2 and have also tried the express edition. I am using XML to store data of constantly changing data schemas, and altho i understand that this will be passed back as a string I need the ability to create stored procedures against the xml data within sql.I have also tried using the .HasDataType() method with no luck.

On a side note I am however able to create varchar and I believe nchar types, but not ntext or text types using the same method.

So really my questions are:

  1. Should i be able to create columns of type xml in EF 4.3?
  2. Why can't I?
  3. Is there a correct way/work around to accomplish this?
like image 970
E.L Dunn Avatar asked Feb 08 '12 02:02

E.L Dunn


1 Answers

Thanks for the report. We have identified this as an unintended breaking change in EF 4.3. The reason for the change is that we switched DDL generation to use the new engine in Code First Migrations for SQL Server databases and Code First Migrations doesn't currently honor all possible database data types. We plan to include a fix for this issue in EF 4.3.1 in a few weeks from now.

like image 124
divega Avatar answered Oct 16 '22 08:10

divega