Click here to Skip to main content
15,906,467 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am working on entity framework core code first approach.and i set column type nvarchar(100) but it will save data like ?????

What I have tried:

builder.Property(x => x.FirstNameN).HasColumnType("nvarchar(100)").IsUnicode(true);
Posted
Updated 27-Feb-19 4:53am
Comments
MadMyche 27-Feb-19 11:30am    
1. What RDB are you using; SQL Server, MySql, MS Access?
2. What character set are you using? Does your code tell EF that?
3. How are viewing the data; calling it back into App or using external tool?

"Nvarchar(100)" is NOT a "type"; "nvarchar" is.

"nvarchar" is also the default.
 
Share this answer
 
builder.Property(x => x.FirstNameN).HasColumnType("nvarchar").HasMaxLength(100);


If you;re using MySQL you can set is as unicode using Data Annotations:

MySQL :: MySQL Connector/NET Developer Guide :: 9.2.3 Configuring Character Sets and Collations in EF Core[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900