开发者

entity framework 4 and sql server datatype (nchar vs char)

i'm developing a web app application and I'm using EntityFramework ObjectModel to design my Model layer.

The matter is that I've some string fields (like 'CodiceFiscale', an unique identifier for people in Italy) that should be 16 char long. The designer let me make it fixed length, max length = 16, but it means the field will be nchar(16) in sql server.

Is there any chance to set that field as char (开发者_运维问答I'd like to avoid field padding at the end)

thx in advance


Just use the MaxLength = 16, FixedLength = false settings in your model:

entity framework 4 and sql server datatype (nchar vs char)

That ought to result in a NVARCHAR(16) column, and that's what you're looking for.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜