Hi,
I have in the database a column of type XMLType.
In a code first scenario, how should I map the XMLType in my model?
I tried mapping it to string.
Reading the entity: no problems
Writing the entity:
- No problem if I put a MaxLength of 4000, but then I can't write an XML > 4000
- If I do not put a MexLength on it, I get the following error:
ORA-00932: inconsistent datatypes: expected - got CLOB
How should I do this with EF?
XMLType in Entity Framework 6
Re: XMLType in Entity Framework 6
Please try this setting: config.CodeFirstOptions.UseNonLobStrings=true;
Refer to http://devart.com/dotconnect/oracle/doc ... tions.html.
Does this help?
Refer to http://devart.com/dotconnect/oracle/doc ... tions.html.
Does this help?
Re: XMLType in Entity Framework 6
I already tried that one and that limits the size to 2000 characters.
Also I tried the recommended way for EF6 (https://blog.devart.com/entity-framewor ... force.html):
But obviously the same problem with xml > 2000 characters
Also I tried the recommended way for EF6 (https://blog.devart.com/entity-framewor ... force.html):
Code: Select all
modelBuilder
.Properties()
.Where(p => p.PropertyType == typeof(string) &&
p.GetCustomAttributes(typeof(MaxLengthAttribute), false).Length == 0)
.Configure(p => p.HasMaxLength(2000));
Re: XMLType in Entity Framework 6
Please set column type in fluent (or attribute) mapping explicitly: .HasColumnType("xmltype");
Notify us about the result.
Notify us about the result.
Re: XMLType in Entity Framework 6
Yes! That works!
Thanks!
Thanks!