I have a table with nvarchar field (MS SQL Server 2008 R2). For testing, this code works fine:
Update [Screenshots] set name=N'Значение' where id=230246
right now I created Entity Framework model, I have set Unicode as True
then I try to update my record:
public void Put(FormDataCollection formData)
{
string filename = formData.Get("filename");
var screenshot = c.Screenshots.Where(p => p.filename == filename).FirstOrDefault();
if (screenshot != null)
{
screenshot.name = formData.Get("description");
c.SaveChanges();
}
}
but I got "?????" instead of unicode value. How to do it? I know about AsNonUnicode method, but this method works only for LINQ.
Are you sure that formData.Get("description")
returns UTF-8 string (that it isn't converted somewhere)?
What is your approach in entity framework? Code-first/Design-first/Database-first?
Try to remove database and recreate - remove database and then in designer right click -> Generate database from model...
Get Entity Framework Profiler from Nu-get package manager and see what query is sending to database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With