Creating blob properties with Entity Framework 4?
I am creating an EF4 model-first application with a WPF UI. One of the controls on my UI is a RichTextDocument, which outputs a WPF FlowDocument. I can either serialize the FlowDocument to a byte array, or extract its XAML markup as a string. I w开发者_高级运维ould prefer to use binary serialization, if I can. Here are my questions:
If I serialize to a byte array, how do I specify an entity property as a byte array in the EDM Designer?
If I extract a XAML markup string, can I specify that the EDM Designer create the corresponding database column as a
nvarchar(max)
column?
As to the second question, I assume I could always manually edit the MyModel.edmx.sql file to change the data type from nvarchar(4000)
to nvarchar(max)
before executing it, but I would like to know if it can be done in the Designer.
Thanks for your help.
Finally got back to this one. Turns out that if it had been any more obvious, I'd have tripped over it. EDM has a Binary
type that creates a property of type byte[]
on an entity class. While the types in the EDM Designer generally match CLR type names, that's not true in all cases, as this issue shows.
For nvarchar(max) specify size |maxlength?| as -1 value. As it was described one of in MSDN articles, -1 size value corresponds to MAX sl size specifier, as i remember...
精彩评论