Hi i’m trying to update a record with a cyrilic text. But the text get saved as
???
my field is set as nvarchar(max) and in fact if I set the record manually on the db the value is stored correctly.
But when saved from OrmLite it goes crazy.
I never had to deal with cyrilic so I may miss something.
my orm lite poco is
[CompositeIndex(new string[] {"Key", "LanguageId", "ApplicationId"}, Unique = true)]
public class Translation : AuditBase, IHasIntId, IHasId<int>
{
[AutoIncrement]
public int Id { get; set; }
[Reference]
public Application Application { get; set; }
public int ApplicationId { get; set; }
public string Key { get; set; }
[Reference]
public Language Language { get; set; }
public int LanguageId { get; set; }
[CustomField("{NMAX_TEXT}")]
public string Value { get; set; }
}
OrmLite just passes the string as a parameter to the underlying ADO .NET provider, so the underlying RDBMS data type and/or collation needs to support it.
What’s the problematic SQL OrmLite generates that has the issue?
That’s expected behavior when using inline SQL when inserting Unicode text in literal strings, it’s not an option in DB parameters which shouldn’t need it. What’s the value you’re inserting and what’s the data type you’re inserting it into? If you’ve used OrmLite to generate the table can you provide the CREATE TABLE SQL.
The data type i’m inserting into is nvarchar(max) on the Value Column
create table Translation
(
Id int identity
primary key,
ApplicationId int not null,
[Key] varchar(8000),
LanguageId int not null,
Value nvarchar(max),
CreatedDate datetime not null,
CreatedBy varchar(8000) not null,
ModifiedDate datetime not null,
ModifiedBy varchar(8000) not null,
DeletedDate datetime,
DeletedBy varchar(8000)
)
go
create index idx_translation_deleteddate
on Translation (DeletedDate)
go
create unique index uidx_translation_key_languageid_applicationid
on Translation ([Key], LanguageId, ApplicationId)
go